Program to check operator results
#include<stdio.h> #include<stdlib.h> operators() { printf("to check operator results\n"); implicit(); assign(); arithmatic(); exit(0); } implicit() { float a; float b; int c; printf("enter values for a and b\n"); scanf("%f%f",&a,&b); c=a/(int)b; printf("division is %d\n",c); } assign() { int a,b,c,d,e,f; printf("enter values for a and b\n"); scanf("%d%d",&a,&b); c=(a=b); d=a; e=(c>d); f=(d!=e); printf("c=%d\td=%d\te=%d\tf=%d\n",c,d,e,f); } arithmatic() { int a,b,g; float c,d,e,f; printf("enter values for a and b\n"); scanf("%d%d",&a,&b); c=a+b; d=a-b; e=a*b; f=a/b; g=a%b; printf("c=%f\td=%f\te=%f\tf=%f\tg=%d\n",c,d,e,f,g); exit(0); }OutPut:
madan@madan-Lenovo-G570:~/madan$ cc -nostartfiles ex36.c /usr/bin/ld: warning: cannot find entry symbol _start; defaulting to 0000000000400440 madan@madan-Lenovo-G570:~/madan$ ./a.out to check operator results enter values for a and b 12 2 division is 6 enter values for a and b 12 2 c=2 d=2 e=0 f=1 enter values for a and b 12 2 Segmentation fault (core dumped)