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



main() { int a = 65; printf(“%d %o %x”,a,a,a); } Output 65 101 41 Please expla..

Answer / neha

It prints the value of in decimal, octal, hexadecimal
format respectively.

Is This Answer Correct ?    6 Yes 0 No

main() { int a = 65; printf(“%d %o %x”,a,a,a); } Output 65 101 41 Please expla..

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

main() { int a = 65; printf(“%d %o %x”,a,a,a); } Output 65 101 41 Please expla..

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

Post New Answer

More C Interview Questions

What is a union?

0 Answers  


#include main() { char s[] = "Bouquets and Brickbats"; printf(" %c, ",*(&s[2])); printf("%s, ",s+5); printf(" %s",s); printf(" %c",*(s+2)); }

0 Answers   Wilco,


main() { int a = 65; printf(“%d %o %x”,a,a,a); } Output 65 101 41 Please explain me.How it is coming like that?

3 Answers   Excel,


character array A[12] can hold

5 Answers   Wipro,


Write a C++ program to generate 10 integer numbers between - 1000 and 1000, then store the summation of the odd positive numbers in variable call it sum_pos, then find the maximum digit in this variable regardless of its digits length.

0 Answers  






#include main() { int *p, *c, i; i = 5; p = (int*) (malloc(sizeof(i))); printf(" %d",*p); *p = 10; printf(" %d %d",i,*p); c = (int*) calloc(2); printf(" %d ",*c); }

0 Answers   Wilco,


what is mean by Garbage collection ? Please answer me. Advance thanks.

4 Answers   Excel,


What is static volatile in c?

0 Answers  


what is difference between procedural language and functional language ?

4 Answers   Wipro,


write a programme that inputs a number by user and gives its multiplication table.

2 Answers  


Why pointers are used in c?

0 Answers  


why effort estimation is important?

1 Answers  


Categories