a simple c program using 'for' loop to display the output

5

4

3

2

1

Answers were Sorted based on User's Feedback



a simple c program using 'for' loop to display the output 5 4 3 2 1..

Answer / 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

a simple c program using 'for' loop to display the output 5 4 3 2 1..

Answer / rohit dilip kakade

#include<stdio.h>
#include<conio.h>
void main(void)
{
   int i;
clrscr();
    for(i=5;i>0;i--)
{
      printf("
%d",i);
}
getch();
}

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

Explain how can I avoid the abort, retry, fail messages?

0 Answers  


Why do we use pointer to pointer in c?

0 Answers  


What do header files do?

0 Answers  


Why we use break in c?

0 Answers  


what is const volatile?

2 Answers  


what is use#in c

3 Answers  


What is null in c?

0 Answers  


What do mean by network ?

0 Answers  


Write a program to print ASCII code for a given digit.

0 Answers   EXL, HCL,


Why is struct padding needed?

0 Answers  


What is line in c preprocessor?

0 Answers  


I need a help with a program: Write a C program that uses data input in determining the whole of points A and a whole of circles B. Find two points in A so that the line which passes through them, cut through the maximum number of circles.

0 Answers   TCS,


Categories