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 ^_^

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: 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...

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).

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...

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

meanwhile,

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

> 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 <name>!' *

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

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.

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.

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

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.


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

2) a program that takes ur date of birth and tell about ur star

Zodiac Sign?

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

3) take input from user and then print that numbers table (times table)
4) print odd and even numders using 1 loop

3.

#include<stdio.h>
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?

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

3.

#include<stdio.h>
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

3.

#include<stdio.h>
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?

no suppose i tell u to print the odd numbers from1-20 then u have to print only odd numbers like
1 3 5 7 9 .....19
but the user can give u any point

no suppose i tell u to print the odd numbers from1-20 then u have to print only odd numbers like
1 3 5 7 9 .....19
but the user can give u any point

Whether in recession or not, you don't need to save characters.
It is alright to say: `you' instead of `u'.

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

my answer is already correct.. just add something there in the second to the last printf

no suppose i tell u to print the odd numbers from1-20 then u have to print only odd numbers like
1 3 5 7 9 .....19
but the user can give u any point

oh!, i'll answer this when my classes ends .. I'll go now, i only have 30 min left to go to school..

But i think i already answered this last year.. input an integer "y", find its factorial, its "x" preceding odd integers, its "x" succeeding even integers, the sum of the preceeding integers, the average of the succeeding and tell if "y" is odd or even.


"x"= user input


I'll be going now.. bye!

This article has been dead for over six months. Start a new discussion instead.