main()
{
int a = 65;
printf(“%d %o %x”,a,a,a);
}
Output
65 101 41
Please explain me.How it is coming like that?
Answer Posted / chandan
printf(�%d %o %x�,a,a,a);
1) We can use ? sign instead of " sing in pintf statement .
2)First o/p value 65 ,is the decimal value of int a.
3)2nd o/p value 101 , is the octal value of int a.
i.e base is 8.
8^2 8^1 8^0
1 0 1
it Works 8^2 *1 + 8^1 *0 + 8^0*1 = 64*1 + 8*0 + 1*1=64+0+1=65
it is actual input decimal value.
Similarly,
4)3rd o/p value 41 , is the Hexadecimal value of int a.
i.e base is 16.
16^1 16^0
4 1
it Works 16^1 *4 + 16^0*1 = 16*4 + 1*1=64+1=65
it is actual input decimal value.
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What does c mean?
What does sizeof function do?
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.
Can you assign a different address to an array tag?
How can I read a binary data file properly?
How can you convert integers to binary or hexadecimal?
Explain 'bit masking'?
How does struct work in c?
Is it possible to pass an entire structure to functions?
In C programming, how do you insert quote characters (‘ and “) into the output screen?
If one class contains another class as a member, in what order are the two class constructors called a) Constructor for the member class is called first b) Constructor for the member class is called second c) Only one of the constructors is called d) all of the above
What is chain pointer in c?
What is assignment operator?
how to find anagram without using string functions using only loops in c programming
What is the maximum length of an identifier?