#include #include int main(void) { /* keep all declarations at the beginning of your program */ double x, y; int i=1, k=2, n=10; /* type semicolon after every instruction */ /* example of casting to a different type. Here we cast integer to double */ x = ((double) 99) / 100; printf("x= %lf \n", x); /* example of a mixed arithmetical expression */ y = 10 + x; printf("y= %lf \n", y); /* example of shortcut operators */ /* Warning: ++i is not same as i++ */ k = ++i + k; printf("k= %d i=%d \n", k, i); n = n + i++; printf("n= %d i=%d \n", n, i); /* To demo the predefined constant macro for the largest random number. We can access value of RAND_MAX because it is defined in stdlib.h that we have included */ printf("On this machine RAND_MAX= %d \n", RAND_MAX); /* Function rand() is declared in stdlib.h that we have included above */ n = rand(); /* generate a random integer number */ printf("n= %d \n", n); return(0); }