//one line comment - same as # in Python /* multiple same as """ """ in Python lines of comments */ //this program will print lines of text //this program will introduce input statement - scanf #include //similat to import in Python, stdio library - standard input/output int main(){ //Part I printf("Hello world\n"); //\n will print new line printf("my name is C\tI learn C today\n"); //\t prints TAB space printf("Printing quotes and double quotes \' \"\n"); //have to put \ before the character printf("printing backslash \\ \n"); printf("printing percent character %% \n"); //Part II //this part will read two integers and finds their sum (+) product (*) difference (-) int num1, num2; //declaration of variables int sum=0; //declaration and initialization printf("enter two integers\n"); scanf("%d%d",&num1,&num2); //%d - int type input /* scanf("%d",&num1); scanf("%d",&num2); */ sum=num1+num2; printf("sum is %d\n",sum); //%d to print integer type int product,difference; product=num1*num2; difference=num1-num2; printf("product and difference are %d,%d\n",product,difference); //find num1 modulo num2 modulo = % int modulo; modulo=num1%num2; printf("modulo is %d\n",modulo); //Part III - floating point numbers and division float a; //single precision double b; //double precision //input %f - float, %lf - double //output: %f - float/double //find sum and product of two decimal point numbers float k1, k2; printf("enter two floats\n"); scanf("%f%f",&k1,&k2); printf("sum is %f + %f = %f\n",k1,k2,k1+k2); a=k1*k2; printf("product is %f\n",a); //difference (-) of two decimal point numbers printf("%f - %f = %f\n", k1, k2, k1-k2); //sum, product and difference of doubles double m1,m2; printf("enter two doubles\n"); scanf("%lf%lf",&m1,&m2); b=m1+m2; printf("sum=%f, product=%f, difference=%f\n",b, m1*m2, m1-m2); //Part 4 - division (/) of integers //int/int - truncated integer, same as integer division in Python printf("%d\n", 7/2); printf("%f\n",(double)(7)/2.0); return 0; }