main()
{
int a = 65;
printf(“%d %o %x”,a,a,a);
}
Output
65 101 41
Please explain me.How it is coming like that?
Answers were Sorted based on User's Feedback
Answer / neha
It prints the value of in decimal, octal, hexadecimal
format respectively.
Is This Answer Correct ? | 6 Yes | 0 No |
Answer / ruchika thakur
in octal,divide 65 by 8 and collect the remainder.it will
return 101....and in hexadecimal,divide 65 by 16 and again
collect the remainder...you will get 41......
THANKS
Is This Answer Correct ? | 5 Yes | 2 No |
Answer / 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 |
i want to job in your company, so how it will be possible.
in C-programming language without using printf statement can we get output r not ? if yes how and if no also how ?
What is d'n in c?
why array index always starts from zero??
What is selection sort in c?
What is getch c?
What is %d called in c?
how to find anagram without using string functions using only loops in c programming
When would you use a pointer to a function?
Why void is used in c?
What is property type c?
Given an array A[n+m] of n+m numbers, where A[1] ... A[n] is sorted and A[n+1] ... A[n+m] is sorted. Design a linear time algorithm to obtain A[1...n+m] sorted using only O(1) extra space. Time Complexity of your algorithm should be O(n) and Space Complexity O(1).