60 608
Assignments Done
97,8%
Successfully Done
In April 2018

Answer to Question #74495 in C for Sushmaswaraj Udatha

Question #74495
#include<stdio.h>
int main()
{
int n;
for(n = 7; n!=0; n--)
printf("n = %d", n--);
getchar();
return 0;
}

anyone tell the o/p ??
Expert's answer
#include <stdio.h>

int main()
{
int n; // declare the variable

// this is the infinity loop because n will never be 0
/*for(n = 7; n != 0; n--)
printf("n = %d", n--);*/

// the right code is next:
// now we check is the n greater than 0
for(n = 7; n >= 0; n--)
printf("n = %d\n", n--);

// wait for the input from user
getchar();
return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions