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 can the sizeof operator be used to tell the size of an array passed to a function?

0 Answers  


Prove or disprove P!=NP.

5 Answers   Microsoft,


int main() { int *p=new int; *p=10; del p; cout<<*p; *p= 60; cout<<*p; } what will be the output & why?

4 Answers   TCS,


how to make a scientific calculater ?

0 Answers  


How are portions of a program disabled in demo versions?

0 Answers  






Is there a way to jump out of a function or functions?

0 Answers  


Explain what is the most efficient way to store flag values?

0 Answers  


What is the difference between call by value and call by reference in c?

0 Answers  


A variable that is defined in a specified portion of a program but can be used throughout the program a) global variable b) local variable c) character d) none

0 Answers  


program that accepts amount in figures and print that in words

2 Answers   Infosys, Lovely Professional University, Wipro,


11. Look at the Code: #include<string.h> void main() { char s1[]="abcd"; char s2[10]; char s3[]="efgh"; int i; clrscr(); i=strcmp(strcat(s3,ctrcpy(s2,s1))strcat(s3,"abcd")); printf("%d",i); } What will be the output? A)No output B) A Non Integer C)0 D) Garbage

7 Answers   Accenture,


There are 3 baskets of fruits with worng lables,one basket has apple,another basket has orange,another has combination of apple and orange,what is the least way of interchange the lables.

15 Answers   Cisco, Google, MBT,


Categories