a simple c program using 'for' loop to display the output
5
4
3
2
1
Answer Posted / prayashjeet chanda
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int num,i;
printf("\nEnter a number: ");
scanf("%d",&num);
for(i=num;i>0;i--)
{
printf("\n%d",i);
}
getch();
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is a program?
How do you convert strings to numbers in C?
What is auto keyword in c?
What is the difference between memcpy and memmove?
What is the scope of an external variable in c?
Define the scope of static variables.
What would happen to X in this expression: X += 15; (assuming the value of X is 5)
Given only putchar (no sprintf, itoa, etc.) write a routine putlong that prints out an unsigned long in decimal. [ I gave the obvious solution of taking % 10 and / 10, which gives us the decimal value in reverse order. This requires an array since we need to print it out in the correct order. The interviewer wasn't too pleased and asked me to give a solution which didn't need the array ].
What are the rules for identifiers in c?
What does return 1 means in c?
Where are some collections of useful code fragments and examples?
What is #include stdio h and #include conio h?
Is it fine to write void main () or main () in c?
How to write a multi-statement macro?
A float occupies 4 bytes in memory. How many bits are used to store exponent part? since we can have up to 38 number for exponent so 2 ki power 6 6, 6 bits will be used. If 6 bits are used why do not we have up to 64 numbers in exponent?