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

fn f(x) { if(x<=0) return; else f(x-1)+x; }

5 Answers   HCL,


write a programe to find the factorial of given number using recursion

3 Answers  


how to write a cprogram yo get output in the form * *** ***** ******* ********* ******* ***** *** *

3 Answers  


what does ‘segmentation violation’ mean?

1 Answers  


if a person is buying coconuts of Rs10,and then sell that coconuts of Rs9,with the loss of one rupee.After that the person became a millaniore.how?

9 Answers   Wipro,


Is it possible to have a function as a parameter in another function?

0 Answers  


typedef struct{ char *; nodeptr next; } * nodeptr ; What does nodeptr stand for?

0 Answers   Wilco,


How would you obtain the current time and difference between two times?

0 Answers   TISL,


write a program that accepts 3 numbers from the user. dispaly the values in a descending order.

3 Answers  


Write a program to implement a round robin scheduler and calculate the average waiting time.Arrival time, burst time, time quantum, and no. of processes should be the inputs.

0 Answers   Aspiring Minds,


What is a const pointer, and how does it differ from a pointer to a const?

2 Answers  


what are the advantage of pointer variables? write a program to count the number of vowels and consonants in a given string

3 Answers  


Categories