write a program to display numbers from 1 to 10 and 10 to 1?

Answers were Sorted based on User's Feedback



write a program to display numbers from 1 to 10 and 10 to 1?..

Answer / sai

#include<stdio.h>
#include<conio.h>
void main()
{
int i;
clrscr();
for(i=1;i<=10;i++)
printf(" %d",i);
printf("\n");
for(i=10;i>=1;i--)
printf(" %d",i);
getch();
}

/* output
1 2 3 4 5 6 7 8 9 10
10 9 8 7 6 5 4 3 2 1 */

Is This Answer Correct ?    6 Yes 2 No

write a program to display numbers from 1 to 10 and 10 to 1?..

Answer / sureshmca

#include<stdio.h>
void main()
{
int num,i;
for(num=0;num<=10;num++)
{
printf("%d",num);
}
}

Is This Answer Correct ?    3 Yes 9 No

Post New Answer

More C Interview Questions

Explain 'bit masking'?

0 Answers   EXL,


What is a ternary operator in c?

0 Answers  


What are the loops in c?

0 Answers  


PROGRAM TO WRITE CONTENTS OF 1 FILE IN REVERSE TO ANOTHER FILE,PROGRAM TO COPY 1 FILE TO ANOTHER BY SPECIFYING FILE NAMES AS COMMAND LINE

0 Answers  


What is the scope of static variables in c language?

0 Answers  






What is the meaning of c in c language?

0 Answers  


why we use pointer in c

7 Answers   HCL, TCS,


what is the difference between const volatile int i & volatile const int j;

2 Answers   HCL,


what will be the out put. #include<stdio.h> void main() { printf("Output:"); printf(1+"vikashpatel"); }//output: ikashpatel

1 Answers   V2 Solutions,


When reallocating memory if any other pointers point into the same piece of memory do you have to readjust these other pointers or do they get readjusted automatically?

0 Answers   TISL,


can u give me the good and very optimised code for a car racing game?

0 Answers  


What is the difference between procedural and declarative language?

0 Answers  


Categories