fork download
  1. /* Given two positive integers X and Y. Your task is to add two integers and output their sum.
  2.  
  3. Input Format:
  4. First line of input contains number of testcase T. For each testcase, there will be a single line, containing two positive integers seperated by space.
  5.  
  6. Output Format:
  7. For each testcase, output the sum of all integers.
  8.  
  9. User Task: Your task is to complete the function add() which returns the sum of two integers.
  10.  
  11. Constraints:
  12. 1 <= T <= 10
  13. 1 <= X, Y <= 1030
  14.  
  15. Example:
  16. Input:
  17. 1
  18. 111111 11111
  19.  
  20. Output:
  21. 122222
  22.  
  23. Explanation:
  24. Testcase 1: Sum of given two integers is 122222.
  25. */
  26. #include <iostream>
  27. using namespace std;
  28.  
  29. int add(int a, int b)
  30. {
  31. return (a+b);
  32. }
  33.  
  34. int main()
  35. {
  36. int n,a,b;
  37. cout<<"enter the number of test cases "<<endl;
  38. for(int i=0; i<n; i++)
  39. {
  40. cin>>n;
  41. }
  42. cin>>a;
  43. cin>>b;
  44. cout<<add(a,b);
  45. return 0;
  46. }
Success #stdin #stdout 0s 4316KB
stdin
2
111111 11111
1111 2222
stdout
enter the number of test cases 
111113