Sum and Difference of Two Numbers Hackerrank Solution - C Language
Code:
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
int main()
{
int a,b;
float c,d;
scanf("%d %d %f %f",&a,&b,&c,&d);
int sum1 = a+b;
int diff1 = a-b;
float sum2 = c+d;
float diff2 = c-d;
printf("%d %d\n",sum1,diff1);
printf("%.1f %.1f",sum2,diff2);
return 0;
}
Comments
Post a Comment