Can someone help me make a simple looping that will print an output of the following.. I cant make a print out of it :( Please help me..
5
1
4
2
3
3
2
4
1
5
Thank you so much !
Printable View
Can someone help me make a simple looping that will print an output of the following.. I cant make a print out of it :( Please help me..
5
1
4
2
3
3
2
4
1
5
Thank you so much !
Sure - What have you done so far :)
Frankly speaking,
This is what I just have for now =((
Am I doing it right? :(Code:#include<stdio.h>
main()
{
int n,m;
for(n=5;n>=1;n--){
printf("\n%d",n);
}
getch();
}
I still got 2 more hours before our Final Exam =((
EDIT:
Code:#include<stdio.h>
main()
{
int n,m;
for(n=5;n>=1;n--){
if(n==5){
printf("\n%d",n);
}
if(n==1){
printf("\n%d",n);
}
}
getch();
}
I am not sure what the significance of the numbers is supposed to be. I suppose putting them in an array would be cheating ...
So this is the end of a C programming class?Quote:
I still got 2 more hours before our Final Exam...
or you can put them in an array and print them, what they rapresent?Code:int i,j;
for(i=5,j=1;i>0;i--,j++) printf("%d\n%d\n",i,j);
I don't really think that this exercise may help you to pass an exam 2 hours before it..
Study hard my friend, study hard.Quote:
I just knew that you can actually print 2 outputs in just 1 printf
The printf is not the most interesting thing about that code. The loop arguments are the interesting part.
Again, Thank you so much guys!! :)