Translate

Total Pageviews

Monday, May 11, 2020

PROBLEM: SUM AND DIFFERENCE OF TWO NUMBER

PROBLEM: Sum and Difference of Two Numbers



" .1f " will give the float type answer upto 1 decimal place.
" %d " will give an integer type answer.

#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>

int main()
{ 
int a,b;
scanf("%d %d",&a,&b);
float a1,b1;
scanf("%f %f",&a1,&b1);
printf("%d %d\n%.1f %.1f",a+b,a-b,a1+b1,a1-b1); 
 return 0;
}

No comments:

Post a Comment