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
WRITE A CODE IN C TO SEARCH A FILE FROM NOTEPAD FILE.
Can we change the value of constant variable in c?
What is equivalent to ++i+++j?
Why do we use main function?
the factorial of non-negative integer n is written n! and is defined as follows: n!=n*(n-1)*(n-2)........1(for values of n greater than or equal to 1 and n!=1(for n=0) Perform the following 1.write a c program that reads a non-negative integer and computes and prints its factorial. 2. write a C program that estimates the value of the mathematical constant e by using the formula: e=1+1/!+1/2!+1/3!+.... 3. write a c program the computes the value ex by using the formula ex=1+x/1!+xsquare/2!+xcube/3!+....
Write a program to print fibonacci series without using recursion?
using for loop sum 2 number of any 4 digit number in c language
What is return in c programming?
What is the best style for code layout in c?
What is graph in c?
write a progrmm in c language take user interface generate table using for loop?
Can we compile a program without main() function?
What was noalias and what ever happened to it?
What is a pointer value and address in c?
What is enumerated data type in c?