0% found this document useful (0 votes)
25 views6 pages

Sheet 2 (Operators)

Uploaded by

Arnav Agrawal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views6 pages

Sheet 2 (Operators)

Uploaded by

Arnav Agrawal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Sheet-2 (Operator Part I) 7. #include <stdio.

h>
int main()
1. #include<stdio.h> {
main() int x= -7 - -9;
int y= -7 - -(-9);
{
printf("x=%d\ny=%d\n",x,y);
return 0;
int a=12,b; }
printf("%d %d",b,b=a);
} y=-16
8. #include <stdio.h>
2. #include<stdio.h> int main()
main() {
{ int x;
int a=10, b=5,c,d; x= 9 % 5 * 4;
printf("x=%d",x);
c=a>9;
return 0;
d=a>3 && b!=3; }
printf("c= %d, d= %d",c,d);
}
3. #include<stdio.h> 9. #include <stdio.h>
main() int main()
{ {
int a=100, b=200,c; int x;
c=(a==100 || b>200); x= 4 - 6 * 5/5 + 7 % 2;;
printf("x= %d",x);
printf("c= %d",c);
return 0;
}
}

4. What will be the output of the


following ‘C’ code?
main ( ) 10. #include <stdio.h>
int main()
{
{
int x = 128;
printf("%d, %d \n",7/4,7%4);
printf (“\n%d”, 1 + x ++); printf("%d, %d \n",7/-4,7%-4);
} printf("%d, %d \n",-7/4,-7%4);
printf("%d, %d \n",-7/-4,-7%-4);
5. #include <stdio.h> return 0;
main() }
{ int a=30,b=40,x;
x=(a!=10) && (b=50); 11. #include <stdio.h>
printf("%d",x); int main()
{
}
int a;
6. #include <stdio.h> float b ;
main() a=9 % 4;
{ b= 9 % 4;
int x=11,y=6,z; printf("%d, %f \n",a,b);
z=x==5||y!=4; return 0;
printf("%d",z); }
}
12. #include <stdio.h> int x=3,y=4,z=4;
int main() printf("ans= %d", z>=y&&y>=x?1:0);
{ return 0;
float a=7, b=3 ; }
int c=a % b;
18. #include <stdio.h>
printf("%d",c);
int main()
return 0;
} {
13. #include <stdio.h> int x=3,y=4,z=4;
printf("ans= %d", (z>=y>=x?100:200));
int main() return 0;
{ }
int a;
a=5^ 8-3*2; 19. #include <stdio.h>
printf("%d",a); int main()
return 0;
{
}
int x=-4,y,z=10;
14. #include <stdio.h> y=x%-3;
int main() y=(y ? 0 : z*z);
{ printf("y= %d",y) ;
float b; return 0;
b=15/3; }
printf("%f, %f",b,15/3);
return 0;
}
20. int main()
{
15. #include <stdio.h>
int i = 1, 2, 3;
int main()
{
printf("%d", i);
int x=10,y=-20;
x=!x;
return 0;
y=!y;
}
printf("x= %d, y= %d", x,y);
return 0;
21. #include <stdio.h>
}
int main()
16. #include <stdio.h>
{
int main()
int i = (1, 2, 3);
{
printf("%d", i);
int x=0,y=1;
return 0;
x=!x;
}
y=!y;
22. #include <stdio.h>
printf("x= %d, y= %d", x,y);
int main()
return 0;
{
}
int i;
i = 1, 2, 3;
17. #include <stdio.h>
printf("%d", i);
int main()
return 0;
{
} }
23. #include <stdio.h>
int main() 29. #include<stdio.h>
{ main()
int a=10,b=10; {
int a=10,b=20,c=30;
printf("ans= %d",a>b?a*a:b/b);
c=a==b;
return 0;
printf("%d%d%d",a,b,c);
} }

24. #include <stdio.h> 30. #include<stdio.h>


int main() main()
{ {
int x=0,y=20; int a=10,b=20,c=30;
x=!!x; c==a==b;
y=!x&& !y; printf("%d%d%d",a,b,c);
printf("x= %d, y= %d",x,y); }
return 0; 31. #include<stdio.h>
main()
}
25. #include<stdio.h> {
main()
int a=10,b;
{
int a=2,b=3,c=1,d; b=a>5?100:200;
d=a<b>=c; printf("%d",b);
printf("%d",d);
}
} 32. int main()
26. #include<stdio.h> {
void main() int a=10,b=20,c=30;
{ c=(10,20)==(c,b);
printf("%d",c);
int a=23,b=12,c=10,d;
d=c+2=b+1=a;
printf("%d %d %d %d",a,b,c,d); return 0;
}
}
33. int main()
27. #include<stdio.h> {
main() int a=10,b=20,c=30;
printf("ans= %d",a>b? a>c?a:c :
{
b>c?b:c);
int a=2,b=3,c=1,d;
d=a<b<c-1;
return 0;
printf("%d",d); }
}
28. #include<stdio.h>
main() 34. #include<stdio.h>
{ main()
int a=10,b=20,c=30; {
c==a=b;
printf("%d%d%d",a,b,c); int a=012,b=034;
int x=0x12,y=0x34; printf("%d%d%d%d",i,j,k,l);

intc,d,u,v; }

c=a&&b; 39. #include<stdio.h>


main()
d=a||b;
{
u=x&&y;
inti=0,j=1,k=2,l;
v=x||y;
l=++i||j++&&++k;
printf(“%d%d%d%d",c,d,u,v);
printf("%d%d%d%d",i,j,k,l);
}
}
35. #include<stdio.h>
main() 40. #include<stdio.h>
main()
{
{
int i=10,j;
inti=0,j=1,k=2,l;
j=++i++;
l=++i&&j++||++k;
printf("%d%d",i,j);
printf("%d %d %d %d",i,j,k,l);
}
}
36. #include<stdio.h>
main() 41. #include<stdio.h>
main()
{
{
int x=20,y=35;
inti=0,j=1,k=2,l;
x=y++ + x++;
l=++i &&--j||++k;
y=++y + ++x;
printf("%d%d%d%d",i,j,k,l);
printf("%d%d",x,y);
}
}
42. #include<stdio.h>
37. #include<stdio.h>
main()
main()
{
{
inti=0,j=1,k=2,l;
int i=100,j=20;
l=++i&&j--||++k;
i++=j;
printf("%d%d%d%d",i,j,k,l);
printf("%d%d",i,j);
}
}
43. #include<stdio.h>
38. #include<stdio.h>
main()
main()
{
{
float a=0.9;
inti=0,j=1,k=2,l;
int c;
l=i||j++&&++k;
c=a<0.9; int i=5;

printf("%d",c); i=!i>3;

} printf("%d",i);

44. #include<stdio.h> }
main()
49. #include<stdio.h>
{
main()
float a=0.5;
{
int c;
int a=10,b=70,c;
c=a==0.5;
c=b=a*=2;
printf("%d",c);
printf("%d%d%d",a,b,c);
}
}
45. #include<stdio.h>
50. #include<stdio.h>
main()
main()
{
{
float a=0.9;
int c=- -2;
int c;
printf("%d",c);
c=a!=0.9;
}
printf("%d",c);
51. #include<stdio.h>
}
main()
46. #include<stdio.h>
{
main()
int c=--2;
{
printf("%d",c);
int a=0,b=0;
}
++a==0||++b==||;
52. #include<stdio.h>
printf("%d%d",a,b);
main()
}
{
47. #include<stdio.h>
int i=5;
main()
printf("%d%d%d%d%d",i++,i--,++i,--i,i);
{
}
int x=4+2%-8;
53. #include<stdio.h>
printf("%d",x);
main()
}
{
48. #include<stdio.h>
200;
main()
printf("%d",200);
{
} x*=y*=y+28.5;

printf("%f%f",x,y);
54. #include<stdio.h>
}
main()
59. #include<stdio.h>
{
main()
int i=-1;
{
+i;
float u=3.5;
printf("%d%d",i,+i);
int v,w,x,y;
}
v=(int)(u+0.5);
55. #include<stdio.h>
w=(int)u+0.5;
main()
x=(int)((int)u+0.5);
(
y=(u+(int)0.5);
char not;
printf("%d%d%d%d",v,w,x,y);
not=!2;
}
printf("%d",not);
60. #include<stdio.h>
}
main()

{
56. #include<stdio.h>
main() int u=3.5,v,w,x,y;
{ v=(int)(u+0.5);
const int i=4; w=(int)u+0.5;
float j; x=(int)((int)u+0.5);
j=++; y=(u+(int)0.5);
printf("%d%d",i,++j); printf("%d%d%d%d",v,w,x,y);
} }
57. #include<stdio.h> 61. #include <stdio.h>
main() int main()
{
{
int a=3,b=4;
inti=5; b%=3+4;
a*=a+5;
printf("%d",i=++i==6);
printf("b= %d a= %d",b,a);
} return 0;
}
58. #include<stdio.h> 62. int main()
main() {
{ inti = 3;
printf("%d", (++i)++);
float x,y; return 0;
x=7:y=10; }

You might also like