Wednesday, December 6, 2017

String Numbers Sum - CTS2

Given two numbers, which are given as Strings, return us a string which is the sum of these two numbers. Please DO NOT convert to integers using inbuilt string functions.

Sample Input & Output:
Input: 145 39
Output: 184

Note: Don’t use scanf, cin or Scanner class. Use command line arguments to get inputs

Solution:
#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[])
{
  printf("%d",atoi(argv[1])+atoi(argv[2]));
}


Share: