https://www.codechef.com/problems/FLOW001
In C#................
using System;
public class Program
{
public static void Main()
{
int T = Convert.ToInt32(Console.ReadLine());
for (int i = 0; i < T;i++ )
{
string s = Console.ReadLine();
string[] values = s.Split(' ');
int a = int.Parse(values[0]);
int b = int.Parse(values[1]);
Console.WriteLine(a+b);
}
Console.ReadKey();
}
}
In C++....
In C#................
using System;
public class Program
{
public static void Main()
{
int T = Convert.ToInt32(Console.ReadLine());
for (int i = 0; i < T;i++ )
{
string s = Console.ReadLine();
string[] values = s.Split(' ');
int a = int.Parse(values[0]);
int b = int.Parse(values[1]);
Console.WriteLine(a+b);
}
Console.ReadKey();
}
}
In C++....
#include<iostream> using namespace std; int main() { int t; cin>>t; while(t--) { int a,b; cin>>a>>b; cout<<a+b<<endl; } return 0; }
This comment has been removed by the author.
ReplyDeleteWhy here using while loop for adding two element in c++.
ReplyDelete