C examples for Language Basics:printf
Write a program that creates an integer variable called toes.
Have the program set toes 10.
Calculate what twice toes is and what toes squared is.
Print all three values, identifying them.
#include <stdio.h> int main(void) { /*from w ww . jav a 2s . c om*/ int toes; toes = 10; printf("toes = %d\n", toes); printf("Twice toes = %d\n", 2 * toes); printf("toes squared = %d\n", toes * toes); return 0; }