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

write a prgram of swapping with 2 valiables

6 Answers  


1.what are local and global variables? 2.what is the scope of static variables? 3.what is the difference between static and global variables? 4.what are volatile variables? 5.what is the use of 'auto' keyword? 6.how do we make a global variable accessible across files? Explain the extern keyword? 7.what is a function prototype? 8.what does keyword 'extern' mean in a function declaration?

2 Answers   nvidia,


The postoder traversal is 7,14,3,55,22,5,17 Then ur Inorder traversal is??? please help me on this

1 Answers  


What should be keep precautions while using the recursion method?

1 Answers  


how to find anagram without using string functions using only loops in c programming

0 Answers  


how can u print a message without using any library function in c

1 Answers   NIIT,


What is variable and explain rules to declare variable in c?

0 Answers  


what is the purpose of the code, and is there any problem with it. unsigned int v[10]; unsigned int i = 0; while (i < 10) v[i] = i++;

2 Answers   Google,


the format specified for hexa decimal is a.%d b.%o c.%x d.%u

7 Answers   TCS,


What is the maximum no. of arguments that can be given in a command line in C.?

0 Answers   HCL,


What are the advantages of using linked list for tree construction?

0 Answers  


Is main is a keyword in c?

0 Answers  


Categories