top of page

1    #include<stdio.h>

 2    int main(void){

 3       printf("Hello World!\n");
 4       return 0;
 5    }
===========================================================================       
 1    #include<stdio.h>
 2    #include<math.h>
 3    #define PI 3.14159265358979323846

 4    int main(void){

 5       int a=2, b, c;
 6       double d=0.5, e, f;

 7       b=3;
 8       e=1.e-2;

 9       c=a+b;
10       f=d*e;

11       printf("sum of %d and %d is %d\n", a, b, c);
12       printf("product of %f and %f is %f or %e in scientific notation\n",
13               d, e, f, f);

14       e=cos(d*PI);
15       d=sin(d*PI);
   
16       printf("sine and cosine of pi/2 are %f and %f\n", e, d);
   
17       return 0;
18    }

  • b-facebook
  • Twitter Round
  • b-googleplus
bottom of page