Mega Code Archive

 
Categories / C Tutorial / Language
 

Use printf to output variable

#include <stdio.h>           int main()      {           int term;       /* term used in two expressions */          term = 3 * 5;           printf("Twice %d is %d\n", term, 2*term);           printf("Three times %d is %d\n", term, 3*term);         return (0);     } Twice 15 is 30 Three times 15 is 45 The number of %d conversions should match the number of expressions.