// your code goes her#include <stdio.h> int main ()
{
/* variable definition: */
int a, b, c;float f, g1, g2, h1, h2;
/* variable initialization */
a =10; b =20;
f =75.0; g1 =3.0;
g2 =0.0;
// Calculate sum of a and b c = a + b;
//Note: a,b,c are Declared as Integer, hence we use %d as the formatter. //Wherever you put the formatter symbol (i.e %d) is where the variable value is substituted. //The order of the substitution is the same as the order of the variable list at the end (a,b,c) //Note the tab (\t) in the statement also. printf(" The sum of Integers (%d) and (%d) is : \t %d \n", a, b, c); // value of a is substituted here ^ value of b ^ value c ^ here
// Calculate quotients
h1 = f/g1;
h2 = f/g2;
//Note: f,g,h are Declared as Float, hence we use %f as the formatter. printf(" The number (%f) divided by (%f) yields the quotient (%f) \n", f, g1, h1);
printf(" The number (%f) divided by (%f) yields the quotient (%f) \n", f, g2, h2);
prog.c: In function ‘main’:
prog.c:25:1: warning: statement with no effect [-Wunused-value]
4
^
prog.c:27:1: error: expected ‘;’ before ‘}’ token
}e
^
prog.c:7:36: warning: variable ‘h1’ set but not used [-Wunused-but-set-variable]
int a, b, c; float f, g1, g2, h1, h2;
^~
prog.c:7:13: warning: unused variable ‘c’ [-Wunused-variable]
int a, b, c; float f, g1, g2, h1, h2;
^
prog.c:7:10: warning: variable ‘b’ set but not used [-Wunused-but-set-variable]
int a, b, c; float f, g1, g2, h1, h2;
^
prog.c:7:7: warning: variable ‘a’ set but not used [-Wunused-but-set-variable]
int a, b, c; float f, g1, g2, h1, h2;
^
prog.c:27:2: error: ‘e’ undeclared (first use in this function)
}e
^
prog.c:27:2: note: each undeclared identifier is reported only once for each function it appears in
prog.c:28:2: error: expected ‘;’ before ‘return’
return 0;
^~~~~~