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 925 (Div. 3) 1931D. Divisible Pairs Solution

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

Powered by Blogger.