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
Can you return null in c?
What is n in c?
What is s in c?
FORMATTED INPUT/OUTPUT functions are a) scanf() and printf() b) gets() and puts() c) getchar() and putchar() d) all the above
what is uses of .net
What is static memory allocation? Explain
Can we assign string to char pointer?
while loop contains parts a) initialisation, evalution of an expression,increment /decrement b) initialisation, increment/decrement c) condition evalution d) none of the above
What are the advantages and disadvantages of a heap?
what is the difference between 123 and 0123 in c?
Write a program to print ASCII code for a given digit.
What are the 4 types of programming language?
Can we access the array using a pointer in c language?
What is difference between structure and union with example?
In this assignment you are asked to write a multithreaded program to find the duplicates in an array of 10 million integers. The integers are between -5000,000 to 5000,000 and are generated randomly. Use 10 threads, each thread works on 1000,000 integers. Compare the time needed to accomplish the task with single thread of execution program. Do not include the time to fill the array with integers in the execution time.