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 are extern variables in c?
write a program to generate address labels using structures?
Is a pointer a kind of array?
Explain what header files do I need in order to define the standard library functions I use?
write a programming in c to find the sum of all elements in an array through function.
Is there a built-in function in C that can be used for sorting data?
The performance of an operation in several steps with each step using the output of the preceding step a) recursion b) search c) call by value d) call by reference
What is array within structure?
Why is c faster?
Write a program to check prime number in c programming?
Write a code to remove duplicates in a string.
Describe the header file and its usage in c programming?
Sir i need notes for structure,functions,pointers in c language can you help me please
What type of function is main ()?
What are the advantages and disadvantages of pointers?