Add Them Up

what is the mistake?

#include <stdio.h>
{
int main()
    int firstNumber, secondNumber, sumOfTwoNumbers;
    printf("Enter two integers: ");
    scanf("%d %d", &firstNumber, &secondNumber);
    sumOfTwoNumbers = firstNumber + secondNumber;
    printf("%d + %d = %d", firstNumber, secondNumber, sumOfTwoNumbers);
    return 0;
}
printf("%d + %d = %d", firstNumber, secondNumber, sumOfTwoNumbers);
        ^^^^^^^^^^

Just print the answer, nothing more, nothing else.

you have to take input one time from user using space. And after that split those values… like below:
a = input()
b = a.split(" ")
c =int(b[0])
d = int(b[1])

1 Like

Thanks for the help!

you must use sum integer . That means sum= A+B then printf(“%d”,sum ) ;

#include<conio.h>
int main()
{
int A,B,sum ;

scanf("%d",&A);
   scanf("%d",&B);

sum =A+B ;
printf(“%d”,sum);
return (0) ;

}

use (long long) only

Whats wrong?

A=int(input(""))
B=int(input(""))
Sum=A+B
print(Sum)

why it is taking too much time for checking the files

2 posts were merged into an existing topic: SCB-PA Inter School and College Programming Contest 2019

@hjr265

What’s the problem on my code ? When I test my code I get runtime error.

My code is:

    using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Add_Them_Up
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b;
            a = Convert.ToInt32(Console.ReadLine());
            b = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine(a + b + "\n");
            Console.ReadKey();
        }
    }
}

input style is one line?can you see it.

1 Like
#include<stdio.h>
int main()
{
	int A,B;
	
	scanf("%d %d",&A,&B);
    
	printf("%d",A+B);
	return 0;
}

whats wrong brother…!!

@abcdefgj Your recent submissions have all been made to C#. The code you shared here is in C++. You need to choose the correct programming language.

I am getting error on CPU Limit. What should i do?
Here’s my code

while True:
    output = 0  # dummy value
    try:
        a = input("val1: ")
        b = input("val2: ")
        val1 = int(a)
        val2 = int(b)
        max_input = 20000000
        min_input = -20000000

        if min_input < val1 < max_input and min_input < val2 < max_input:
            output = val1 + val2
            print(output)
            break
        else:
            print(f"Input should be in between of {min_input} to {max_input}")

    except:
        print("Invalid input. Please try again")

actually you are doing mistake to get input, toph return array of two numbers you have to parse them into local variable separately . Need more idea about that ?

Happy to see you doing C#. :boom:

total=int(input("Please enter a number"))
f,s,t=map(int,input().split(','))
k=f+s+t
missing=total-k
print(missing)

whats wrong here it says runtime error

I don’t understand why the wrong answer is showing after submitting.Capture

Welcome to Toph Community, @soton360!

To solve your problem, I’d suggest you to read the whole statement again, carefully.

image

Every problem has test cases beyond the sample ones shown in the problem statement. Your program must be able to handle those hidden cases. Pay close attention to the input specification.

-Toph.co