954,479 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Give me a Problem

I'm new in programming, i really really want to learn and i think i can learn faster if someone will give me problems so that i can answer them without asking for help from others. Now, i learned loop last week so i think i'm on for making programs. I still don't know conio.h yet.. My instructor let us use only the stdio.h library first..

So, can someone post some problems here? just up to loops only.. I hope someone would take this seriously and can help me.

I will be waiting ^_^

moonw3ll
Light Poster
37 posts since Jan 2009
Reputation Points: 10
Solved Threads: 1
 

The real essence of C is in the discovery of C by yourself so try to discover more and read books like "ANSI C" by Kernighan and Ritchie.

1.Try to print the Pascal's Triangle (This requires only looping and a bit of array knowledge.)

2.You need to start imagining and create problems of your own from now on.Best of luck.

csurfer
Posting Pro
568 posts since Jan 2009
Reputation Points: 485
Solved Threads: 88
 

In the C++ form, there is a sticky on project ideals.

MosaicFuneral
Posting Virtuoso
1,691 posts since Nov 2008
Reputation Points: 888
Solved Threads: 116
 

@csurfer: Ty.. I will do what you said.. But in the meantime, i want someone to give me exercises. I'm studying almost everyday but i want someone to give me exercises so that i can test if my knowledge is enough about loops.

Thank you...

moonw3ll
Light Poster
37 posts since Jan 2009
Reputation Points: 10
Solved Threads: 1
 

There's plenty of easy (and not so easy) homework posted on the board. Any of those would make excellent exercises (it's what they're designed for).

Salem
Posting Sage
Team Colleague
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953
 

you can make the prgs like

1) find factorial of given no.

2) find that given no. is prime or not

3) find given no. is pelindrome or not

or you can makes prg like

if user enter : 4 no. then out put must be like

*
**
***
****

u can reverce that one etc...

nitu_thakkar
Light Poster
28 posts since Jan 2009
Reputation Points: 0
Solved Threads: 1
 

@surfer: I haven't learned array but i'm studying..

meanwhile,

@ nitu: i already answered question #1.. #2-#4 remaining.. ty for posting

moonw3ll
Light Poster
37 posts since Jan 2009
Reputation Points: 10
Solved Threads: 1
 

> Give me a Problem

Problem 1
I have just broken your legs with a sledgehammer, how do you get to the hospital?

Problem 2
Try to make a program where you have to enter your name, then the program says, 'Hello !' *


[*] Replace with your actual name. Exclamation mark optional.

iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
 

Ok try to print this as it is:

a,b
aa,ab,ba,bb
aaa,aab,aba,abb,baa,bab,bba,bbb
....
..
.

Upto the line user wants.I hope you can see the patter.Its coefficients of the expansion ( a + b ) ^ n.User will give the value of n and you need to print upto that line. Involves only looping.Try this.

csurfer
Posting Pro
568 posts since Jan 2009
Reputation Points: 485
Solved Threads: 88
 

It will good that i yourself generate the problem and try to solve it instead of searching it.

ajay.krish123
Junior Poster in Training
90 posts since Nov 2008
Reputation Points: 6
Solved Threads: 9
 

if u would mention that on which stage you are i mean how much do you know about C then it was a bit convenient to give you the problem.

Skorpion
Newbie Poster
23 posts since Feb 2009
Reputation Points: 10
Solved Threads: 0
 

only looping... hehe i'm having a hard time on other problems.. just keep coming... this will serve as a challenge for me.

moonw3ll
Light Poster
37 posts since Jan 2009
Reputation Points: 10
Solved Threads: 1
 

hmmm its ok everyone starts from there...actually i myself is also a beginner and these programs helped me alot u also give it a try.
1) create a result card which takes the input of 5 or 6 subjects then give its total, percentage and grade.
2) a program that takes ur date of birth and tell about ur star
3) take input from user and then print that numbers table (times table)
4) print odd and even numders using 1 loop
these r very simple but it'll help u clearify ur logic very much they helped me too.

Skorpion
Newbie Poster
23 posts since Feb 2009
Reputation Points: 10
Solved Threads: 0
 

1) find factorial of given no.

3) find given no. is pelindrome or not .

1.

#include<stdio.h>
main(){
long a,b,c=1;
system("cls");
scanf("%ld",&a);
for(b=a;b>=1;b--)
{
c*=b;
}
printf("The result is: %ld",c);
getch();
}


3.

#include<stdio.h>
main(){
int a,b,c=0,d;
system("cls");
printf("Enter number: ");
scanf("%d",&a);
d=a;
do{
b=a%10;
a/=10;
c=(c*10)+b;
}
while (a>0);
if (d==c){
printf("It is a palindromic number");
}else{
printf("It is not a palindromic number");
}
getch();
}

Just 2 more to go.. hehehe

moonw3ll
Light Poster
37 posts since Jan 2009
Reputation Points: 10
Solved Threads: 1
 
2) a program that takes ur date of birth and tell about ur star

Zodiac Sign?

moonw3ll
Light Poster
37 posts since Jan 2009
Reputation Points: 10
Solved Threads: 1
 
1) create a result card which takes the input of 5 or 6 subjects then give its total, percentage and grade.

Can't understand ur point.. pls clarify

moonw3ll
Light Poster
37 posts since Jan 2009
Reputation Points: 10
Solved Threads: 1
 
3) take input from user and then print that numbers table (times table) 4) print odd and even numders using 1 loop

3.

#include
main(){
int r,t,y;
system("cls");
printf("Enter a number: ");
scanf("%d",&r);
printf("\n\n\n\t%d by %d Multiplication Table\n\n",r,r);
for(t=1;t<=r;t++)
{
for(y=1;y<=r;y++){
printf("%4d",t*y);
}
printf("\n");
}
getch();
}


4. Clarify number this number.. what do you want me to do? get an input from user then tell if it's odd or even? or ask input then prints all the numbers from input value down to 1 and distinguishes if it's odd or even?

moonw3ll
Light Poster
37 posts since Jan 2009
Reputation Points: 10
Solved Threads: 1
 
Zodiac Sign?

yes zodiaz signs

Skorpion
Newbie Poster
23 posts since Feb 2009
Reputation Points: 10
Solved Threads: 0
 
Can't understand ur point.. pls clarify


means take the marks of 5 subjects from user and give the user its sum, percentage and grade

Skorpion
Newbie Poster
23 posts since Feb 2009
Reputation Points: 10
Solved Threads: 0
 

3.

#include main(){ int r,t,y; system("cls"); printf("Enter a number: "); scanf("%d",&r); printf("\n\n\n\t%d by %d Multiplication Table\n\n",r,r); for(t=1;t<=r;t++) { for(y=1;y<=r;y++){ printf("%4d",t*y); } printf("\n"); } getch(); }

4. Clarify number this number.. what do you want me to do? get an input from user then tell if it's odd or even? or ask input then prints all the numbers from input value down to 1 and distinguishes if it's odd or even?


3) take any num input from user suppose 5 and then print the 5 table like
5x1=5
5x2=10
.
.
.
..
5x10=50
but it can b anything not only 5 depending on user

Skorpion
Newbie Poster
23 posts since Feb 2009
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You