STARTER_02 - Editorial

PROBLEM LINK:

Practice
Contest

Author: Rushikesh Thakre
Tester: Rushikesh Thakre
Editorialist: Rushikesh Thakre

DIFFICULTY:

CAKEWALK

PREREQUISITES:

None

PROBLEM:

You are given two positive integers N and M.You have to find the sum and Difference of that two numbers.

QUICK EXPLANATION:

print sum and difference of two number

EXPLANATION:

print sum and difference of two numbers with space between them.

SOLUTIONS:

Setter's Solution
#include <iostream>
using namespace std;
void solve(){
    int n,m;
    cin>>n>>m;
    cout<<n+m<<" "<<n-m<<endl;
}
int main() {
	int t;
	cin>>t;
	while(t--){
	    solve();
	}
	return 0;
}
Tester's Solution
#include <stdio.h>

int main(void)
{   
    int  t,m,n,ans1,ans2,i;
    scanf("%d", &t); 
    for(i =0;i<t;i++) 
    {
         scanf("%d %d", &m,&n); 
         ans1=m+n;  
         ans2=m-n; 
         printf("%d %d",ans1,ans2); 
         printf("\n"); 
    } 
     
    return 0;
}
Editorialist's Solution
#include <stdio.h>

int main(void)
{   
    int  t,m,n,ans1,ans2,i;
    scanf("%d", &t); 
    for(i =0;i<t;i++) 
    {
         scanf("%d %d", &m,&n); 
         ans1=m+n;  
         ans2=m-n; 
         printf("%d %d",ans1,ans2); 
         printf("\n"); 
    } 
     
    return 0;
}