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

what is the use of c program?

4 Answers   Synergy, Web Synergies,


In which layer of the network datastructure format change is done

0 Answers   Honeywell,


What is void main ()?

0 Answers  


What are preprocessor directives in c?

0 Answers  


explain what is a newline escape sequence?

0 Answers  






which type of aspect you want from the student.

0 Answers   IBM, TCS,


wat is output of the following int main() { const int j=2; int i; switch(i) { case 1:break; case j:break; default:break; } }

2 Answers  


Write a program to print prime nums from 1-20 using c programing?

13 Answers   IBM,


c program to compute AREA under integral

0 Answers   Infosys,


How do you determine a file’s attributes?

0 Answers  


What is chain pointer in c?

0 Answers  


void main(int n) { if(n==0) return; main(--n); printf("%d ",n); getch(); } how it work and what will be its output...............it any one know ans plz reply

0 Answers  


Categories