Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
ques.1
Conversation opened. 1 unread message. Skip to content Using Gmail with screen readers Search Click here to enable desktop notifications for Gmail. Learn more Hide Gmail COMPOSE Labels Inbox (5,212) Starred Important Sent Mail Drafts (2) Categories Personal Travel More Hangouts More 1 of many Print all In new window Sheep krti haiii---- Baaaaaaaaaa Inbox x Riya Jain Attachments11:43 PM (3 minutes ago) to me Q1 hai ye: Attachments area Click here to Reply or Forward 0.88 GB (5%) of 15 GB used Manage Terms - Privacy Last account activity: 1 minute ago Details #include<stdio.h> void charbinary(char c) { int q,i; for (i = 7; i >= 0; --i) { q=(c & (1 << i))? 1 :0; printf("%d",q); } } void binary(int c,int size) { int q,i; for (i = size; i >= 0; --i) { q=(c & (1 << i))? 1 :0; printf("%d",q); } } typedef union { float f; struct { unsigned int mantissa : 23; unsigned int exponent : 8; unsigned int sign : 1; } field; } myfloat; typedef union { double d; struct { unsigned long long int mantissa : 52; unsigned int exponent : 11; unsigned int sign : 1; } field; }Double; int main(){ char ch; int i; printf("enter a char: "); scanf("%c",&ch); printf("enter an integer:"); scanf("%d",&i); myfloat var; printf("Enter a float : "); scanf("%f",&var.f); Double dou; printf("Enter a double : "); scanf("%lf",&dou.d); printf("\ninternal representation of,\n"); printf("char(%c): ",ch); charbinary(ch); printf("\n"); printf("int(%d): ",i); binary(i,15); printf("\n"); printf("float(%f): ",var.f); printf("%d ",var.field.sign); binary(var.field.exponent, 7); printf(" "); binary(var.field.mantissa, 22); printf("\n"); printf("double(%lf): ",dou.d); printf("%d ",dou.field.sign); binary(dou.field.exponent, 10); printf(" "); binary(dou.field.mantissa, 51); return 0; }
run
|
edit
|
history
|
help
0
armstrong number using a while loop
18BCE2182 ASSESS_1 Q1-7
Print Micro Seconds
3.1.2 Matrix add/sub file concept
C_141127_MatricesSUMA
Project 4 v.1
htabprepa
structure1
5 trabajo semanal 4
AVANCE PREGUNTA 3 FICHEROS