#include <stdio.h> #include <stdlib.h> #define PROMPT ':' void main(void) { int a,b; char c; int rez; while (putchar(PROMPT), scanf("%d%c%d",&a,&c,&b)!=EOF) { switch (c) { case '+': rez=a+b; break; case '-': rez=a-b; break; case '*': rez=a*b; break; case '/': if (b==0) { printf("\nImpartire la 0"); exit(1); } rez=a/b; break; default: printf("\nOperatie necunoscuta"); exit(1); } printf("\n%d%c%d=%d",a,c,b,rez); } }
int i=3,j=5;determinati valoarea urmatoarelor expresii, precum si valorile lui i si j, dupa evaluarea celor 4 expresii.
int a=2, b=2, c=1, d=0, e=4;determinati valoarea urmatoarelor expresii:
int i=2, j=4;precizati care vor fi valorile lui i si j dupa executia urmatoarei instructiuni:
j = (i++, i-j);
void main(void) { int a,b,c; float z; a=25000; b=15000; c=a+b; z=a+b; z=(float)a+b; c=a/b; c=a%b; c=a>b; z=a/b; z=a/(float)b; c=a=b; c=a!=b; a=3; b=11; c=a++ + ++b; a=0; b=1; c=a&&b; c=a||b; c=!a; a=2; b=5; c=(a-5,b++); c*=a+b; c=(a>b)?a:b; }