In this Hackerrank Sum and Difference of Two Numbers problem we need to develop a C Program in which first, we need to take two numbers of int data type second two numbers of float data type, and then print the sum as an output.


HackerRank Sum and Difference of Two Numbers solution in c


HackerRank Sum and Difference of Two Numbers solution in c

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

int main()
{
	int a, b;
    double x, y;
    scanf("%d %d %lf %lf", &a, &b, &x, &y);
    printf("%d %d\n%0.1lf %0.1lf", a+b, (a-b), x+y, (x-y));
    return 0;
}