3. Int + Short Int & Operator
#include<stdio.h>
void main()
{
int question;
printf("---- Solutions of Int + Short Int ----\n");
while(1)
{
printf("Enter question number : ");
scanf("%d",&question);
switch(question)
{
case 1:;
short int z1 = 99;
printf("%c\n",z1);
break;
case 2:;
short int z2 = 919;
printf("%o\n",z2);
break;
case 3:;
short int z3 = 0777;
printf("%d\n",z3);
break;
case 4:;
short int z4 = 511;
printf("%x\n",z4);
break;
case 5:;
short int z5 = 0511;
printf("%x\n",z5);
break;
case 6:;
short int z6 = '0';
printf("%x\n",z6*z6);
break;
case 7:;
short int z7 = 0x12345;
printf("%x\n",z7);
break;
case 8:;
short int z8 = 0x12345;
printf("%d\n",z8);
break;
case 9:;
short int z9 = 0x12345;
printf("%o\n",z9);
break;
case 10:;
short int z10 = 204;
char c10=z10;
printf("%d\n",c10);
break;
case 11:;
short int i11 = 012345;
char c11 =i11;
printf("%d\n",c11);
break;
case 12:;
short int i12 = 1000;
char c12 = i12;
printf("%d\n",c12);
break;
case 13:;
short int i13 = 1010;
unsigned char c13 = i13;
printf("%d\n",c13);
break;
case 14:;
short int i14 = 0xFACE;
unsigned char c14=i14;
printf("%d\n",c14);
break;
case 15:;
short int i15 = 0x98765;
unsigned char c15 = i15;
printf("%o\n",c15);
break;
case 16:;
int k16 = 0x1234567;
short int i16 = k16;
unsigned char c16 = i16;
printf("%x\n",c16);
break;
case 17:;
int k17 = 0x1234567;
short int i17 = k17;
unsigned char c17 = i17;
printf("%o\n",i17);
break;
case 18:;
int k18 = 0x6789;
short int i18 = k18;
char c18 = i18;
printf("%d\n",c18);
break;
case 19:;
int k19 = 012345;
short int i19 = k19;
char c19 = i19;
printf("%d\n",c19);
break;
case 20:;
int k20 = -500;
short int i20 = k20;
char c20 = i20;
printf("%d\n",c20);
break;
case 21:;
int k21 = -'d';
short int i21 = k21;
char c21 = i21+10;
printf("%d\n",c21);
break;
case 22:;
int k22 = 0x111;
short int i22 = 0111;
char c22 = 111;
k22=k22+c22+i22;
printf("%d\n",k22);
break;
case 23:;
int k23 = 0x111;
short int i23 = 0111;
char c23 = 111;
c23=k23+c23+i23;
printf("%d\n",c23);
break;
case 24:;
unsigned int k24 = 400;
short int i24 =(char)k24;
printf("%d\n",i24);
break;
case 25:;
unsigned int k25 = 304;
short int i25 =(char)k25;
printf("%c\n",i25);
break;
}
}
}
--------------------------------------------------------------------------------------------------------------------
#include<stdio.h>
void main()
{
int question;
int a,b,c;
printf("---- Solutions of Operator ----\n");
while(1)
{
printf("Enter question number : ");
scanf("%d",&question);
switch(question)
{
case 1:
a=11,b=4,c;
c=b%a;
printf("%d\n",c);
break;
case 2:
a=21,b=7,c;
c=b%a/3;
printf("%d\n",c);
break;
case 3:
a=19,b=7,c;
c=-a+b;
printf("%d\n",c);
break;
case 4:
a=37,b=7,c;
c=a%10*10;
printf("%d\n",c);
break;
case 5:
a=-17,b=7,c;
c=a>-b;
printf("%d\n",c);
break;
case 6:
a=17,b=77,c;
c=a>-b;
printf("%d\n",c);
break;
case 7:
a=27,b=7,c;
c=-a>=b;
printf("%d\n",c);
break;
case 8:
a=-17,b=87,c;
c=7%(-a>=b);
printf("%d\n",c);
break;
case 9:
a=77,b=7,c;
c=a%(b-7);
printf("%d\n",c);
break;
case 10:
a=-28,b=-7,c;
c=a%(b-7);
printf("%d\n",c);
break;
case 11:
a=-1,b=7,c;
c=(a-b)*10;
printf("%d\n",c);
break;
case 12:
a=17,b=7,c;
c= b < a / a + b;
printf("%d\n",c);
break;
case 13:
//float a13 =9,b13=56,c13;
//c13=a13%b13+10;
printf("Error\n");
break;
case 14:;
float a14 =05,b14=7,c14;
c14= 35/10;
printf("%f\n",c14);
break;
case 15:;
float a15 =17,b15=7,c15;
c15='A'/10;
printf("%.3f\n",c15);
break;
case 16:;
float a16 =17,b16=10,c16;
c16='a'/b16;
printf("%.2f\n",c16);
break;
case 17:;
double a17 =9,b17=10,c17;
c17='b'/b17;
printf("%lf\n",c17);
break;
case 18:
//double a18 =17,b18=10,c18;
//c18='b'% b18;
printf("Error\n");
break;
case 19:
a=0,b=20,c;
c=a||(b=0);
printf("%d %d \n",c,b);
break;
case 20:
a=0,b=30,c;
c=(a==0)||(b=0);
printf("%d %d\n",c,b);
break;
case 21:
a=00,b=40,c;
c=(a==0)&&(b=0);
printf("%d %d\n",c,b);
break;
case 22:;
int d;
a=0,b=70,c=40,d;
d=(a==0)&&(b=0)||(c=5);
printf("%d %d %d\n",b,c,d);
break;
case 23:
a=0,b='A',c='4',d;
d=(a==0)&&(b=2)||(c=5);
printf("%d %d %d\n",b,c,d);
break;
case 24:
a='A';
!a;
printf("%d\n",a);
break;
case 25:
a=0,b=010,c=49,d;
d=(a==0)||(b=2)||(c=5);
printf("%d %d %d\n",b,c,d);
break;
case 26:
a=0,b=020,c=-1,d;
d=(a==0)||(b=2)&&(c=5);
printf("%d %d %d\n",b,c,d);
break;
case 27:
a=1,b=90,c=4,d;
d=(a==0)&&(b=2)&&(c=5);
printf("%d %d %d\n",b,c,d);
break;
case 28:
//a=1=2;
printf("Error\n");
break;
case 29 :
a='2'+3;
printf("%x\n",a);
break;
case 30 :
a=0x55;
a=0xAA + a;
printf("%d\n",a);
break;
}
}
}
Comments
Post a Comment