C examples for Language Basics:scanf
Read two integers and find out the difference by subtraction
#include <stdio.h> #include <stdlib.h> int main()/*from www . j a v a 2 s . c o m*/ { int diff; int methus; int you; char years[8]; printf("How old are you?"); gets_s(years); you=atoi(years); methus=69; diff=methus-you; printf("You are %d years younger.\n",diff); return(0); }