Read two integers and find out the difference by subtraction - C Language Basics

C examples for Language Basics:scanf

Description

Read two integers and find out the difference by subtraction

Demo Code

#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);
}

Result


Related Tutorials