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

RESTful APIs with CRUD Operations in Laravel 12| (2025)

  RESTful APIs serve as the foundation of modern web development. They follow a set of rules called Representational State Transfer (REST) t...

Powered by Blogger.