fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. // your code goes he// Developer: Faculty CMIS102
  5. // Date: Jan 31, 2014
  6. #include <stdio.h> int main ()
  7. {
  8. /* variable definition: */
  9. int a, b, c; float f, g1, g2, h1, h2;
  10. /* variable initialization */
  11. a = 10; b = 20;
  12. f = 75.0; g1 = 3.0;
  13. g2 = 0.0;
  14.  
  15. // Calculate sum of a and b c = a + b;
  16. //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
  17.  
  18. // Calculate quotients
  19. h1 = f/g1;
  20. h2 = f/g2;
  21.  
  22. //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);
  23.  
  24. printf(" The number (%f) divided by (%f) yields the quotient (%f) \n", f, g2, h2);
  25.  
  26. return 0;
  27. 4
  28.  
  29. }re
  30. return 0;
  31. }
  32.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function ‘main’:
prog.c:6:20: warning: extra tokens at end of #include directive
 #include <stdio.h> int main ()
                    ^~~
prog.c:27:1: warning: statement with no effect [-Wunused-value]
 4
 ^
prog.c:29:1: error: expected ‘;’ before ‘}’ token
 }re
 ^
prog.c:9:36: warning: variable ‘h1’ set but not used [-Wunused-but-set-variable]
   int a, b, c;    float f, g1, g2, h1, h2;
                                    ^~
prog.c:9:13: warning: unused variable ‘c’ [-Wunused-variable]
   int a, b, c;    float f, g1, g2, h1, h2;
             ^
prog.c:9:10: warning: variable ‘b’ set but not used [-Wunused-but-set-variable]
   int a, b, c;    float f, g1, g2, h1, h2;
          ^
prog.c:9:7: warning: variable ‘a’ set but not used [-Wunused-but-set-variable]
   int a, b, c;    float f, g1, g2, h1, h2;
       ^
prog.c:29:2: error: ‘re’ undeclared (first use in this function)
 }re
  ^~
prog.c:29:2: note: each undeclared identifier is reported only once for each function it appears in
prog.c:30:2: error: expected ‘;’ before ‘return’
  return 0;
  ^~~~~~
stdout
Standard output is empty