C Programming - Input / Output - Discussion

Discussion Forum : Input / Output - Find Output of Program (Q.No. 11)
11.
What will be the output of the program ?
#include<stdio.h>

int main()
{
    int a=250;
    printf("%1d\n", a);
    return 0;
}
1250
2
50
250
Answer: Option
Explanation:

int a=250; The variable a is declared as an integer type and initialized to value 250.

printf("%1d\n", a); It prints the value of variable a.

Hence the output of the program is 250.

Discussion:
12 comments Page 2 of 2.

Sanjoy said:   1 decade ago
Why 1 is used before d?

Suri said:   1 decade ago
It will print the value of a after the space of whatever integer is given after %.


Post your comments here:

Your comments will be displayed after verification.