top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Predict the output of below C program?

0 votes
480 views
#include<stdio.h>
int main()
{
   int n;
   for(n = 7; n!=0; n--)
     printf("n = %d", n--);
   getchar();
   return 0;
}
posted Nov 17, 2016 by Tapesh Kulkarni

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

+1 vote
 
Best answer
answer Dec 11, 2016 by Ajay Kumar
+1 vote

It will print out 7, 5, 3 , 1 , -1, -3 , -5 ... and so on

answer Nov 17, 2016 by Vimal Kumar Mishra
Similar Questions
+3 votes

1.

main()
{
printf("%x",-1<<4);
}

2.

main()
{
int i=10;
i=!i>14;
Printf ("i=%d",i);
}
0 votes
#include<stdio.h>
main()
{
        int a=10;
        printf("%d\n",a++==a);
}

Output should be 1 but it is coming as 0,
Can anyone please explain?

+3 votes

input: 1 2 3 4 5
output: 5 4 1 2 3 or 1 2 3 5 4

Can any one tell?

...