Toph easy problem(Missing Number)

Question:

Missing Number

Limits: 1s, 512 MB

Given the sum of four numbers and three of those numbers, find the missing number.
All four numbers are positive integers.

Input

The input will contain one integer (the sum of the four numbers) in the first line and 3 integers (three of those four numbers) in the second line.

Output

Print the missing number.

Samples

InputOutput
10
1 2 3

Solve in C:
#include<stdio.h>
int main(){

int sum,a,b,c,value;
scanf("%d",&sum);
scanf("%d %d %d",&a,&b,&c);
value=sum-(a+b+c);
printf("%d\n",value);
return 0;
}


4

No comments

Most View Post

Recent post

Codeforces Round 971 (Div. 4) 2009C. The Legend of Freya the Frog Solution

  Problem Link    https://codeforces.com/contest/2009/problem/C S olution in C++: /// Author : AH_Tonmoy #include < bits / stdc ++. h ...

Powered by Blogger.