#include <stdio.h> void main(void) { int x = 94; printf("Decimal= %d Octal= %o; Hexadecimal= %x (%X)\n", x, x, x, x); }
#include <stdio.h> void main(void) { short i = 32767; printf("%d %d %d\n", i, i + 1, i + 2); }
#include <stdio.h> void main(void) { float x, y; x = 3.14 printf("%f %e %g\n", x, x, x); x = 1e38; /* FLT_MAX */ printf("%f %e %g\n", x, x, x); y = x * 10; /* Overflow */ printf("%f %e %g\n", y, y, y); y = x + 10000; /* Roundoff error */ x = y - 1; printf("%f %e %g\n", x, x, x, y); }
#include <stdio.h> void main(void) { int age; printf("Enter your age: "); scanf("%d", &age); printf("You are %d old\n", age); }
includemain ( float g; h; float tax, rate; g = e21; tax = rate * g; )
Find the errors:
void main(int) / this program is perfect / { cows, legs integer; printf("How many cow legs did you count\n); scanf("%c", legs); cows = legs / 4; printf("That imples there are %f cows.\n", cows); }