Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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(&#65533;%d %o %x&#65533;,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

Can you pass an entire structure to functions?

0 Answers  


Why do we use null pointer?

0 Answers  


the portion of a computer program within which the definition of the variable remains unchanged a) mode b) module c) scope d) none

0 Answers  


What is function prototype in c with example?

0 Answers  


What is the total generic pointer type?

0 Answers  


What is the purpose of void pointer?

0 Answers  


main() { unsigned int k = 987 , i = 0; char trans[10]; do { trans[i++] =(char) (k%16 > 9 ? k%16 - 10 + 'a' : '\0' ); } while(k /= 16); printf("%s\n", trans); }

4 Answers   Vector,


Write a program to print “hello world” without using semicolon?

0 Answers  


what is a c-language.what is do.

4 Answers   HCL,


i=20,k=0; for(j=1;j<i;j=1+4*(i/j)) { k+=j<10?4:3; } printf("%d", k);

8 Answers   HCL,


Write a c program to build a heap method using Pointer to function and pointer to structure ?

0 Answers   MAHINDRA, Protech, Sivan Tech,


How to declare a variable?

0 Answers  


Categories