Z 321 Add Two Values HackerRank Answer

Given two values, they can be integer or floating point numbers, add them.

Input Format

Two values separated by a space.

Constraints

No constraints.

Output Format

One value, the result of sum of two input values.

Sample Input 0

5 4

Sample Output 0

9

Explanation 0

5 + 4 = 9

Source Code:

#include <stdio.h>

#include <string.h>

#include <math.h>

#include <stdlib.h>


int main() {

float a,b;

    scanf("%f%f",&a,&b);

    long long int c=a+b;

    if(c<(a+b))

        printf("%.2f",a+b);

    else

        printf("%lld",c);

    

    return 0;

}


Comments