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?

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the deal on sprintf_s return value?

1070


we called a function and passed something do it we have always passed the "values" of variables to the called function. such functions calles are called a) calls by reference b) calls by value c) calls by zero d) none of the above

1106


What is floating point constants?

1086


What are the c keywords?

1148


Do array subscripts always start with zero?

1240


When should the register modifier be used? Does it really help?

925


What is array of structure in c programming?

1242


Write a code to generate a series where the next element is the sum of last k terms.

1173


What does %p mean?

1037


What is dynamic memory allocation?

1287


Is there any possibility to create customized header file with c programming language?

1009


What is 02d in c?

1030


Who is the main contributor in designing the c language after dennis ritchie?

955


write a c program to calculate sum of digits till it reduces to a single digit using recursion

3250


How can I find out how much free space is available on disk?

1015