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 RTGS N MINIMUM AMT TO B TRANSFERD N WHAT R THE CHARGES ON MINIMUM AMT N IN WHICH BANK WE CAN DO IT?

1 Answers  


void main() { int a=1; printf("%d %d %d",a,++a,a++); } the output is supposed to be 1 2 2....but it is 3 3 1 this is due to calling conventions of C. if anyone can explain me how it happens?

7 Answers  


Write a program to interchange two variables without using the third variable?

17 Answers   Accenture, College School Exams Tests, Infotech,


Is the below things valid & where it will be stored in memory layout ? static const volatile int i; register struct { } ; static register;

2 Answers   Bosch,


What are the types of i/o functions?

0 Answers  






What is #include in c?

0 Answers  


What is static and auto variables in c?

0 Answers  


what is c

1 Answers  


what are the facialities provided by you after the selection of the student.

0 Answers   TCS,


write a c program that if the given number is prime, and their rearrangement(permute) of that number is also prime. Ex: Input is "197" is prime Output: 791,917,179 is also prime. Please any one tell me tha code for that

3 Answers  


How are 16- and 32-bit numbers stored?

0 Answers  


Difference Between embedded software and soft ware?

1 Answers   Bosch,


Categories