TESTINT - Test 1


Given two natural numbers (both not greater than 200), each number in the separate line, please print the sum of them.

Example

Input:
2
3

Output:
5

hide comments
little_scheme: 2016-09-15 05:08:34

how can i submit scheme lang,because i cant write something like scanf() in c..

vivaan212: 2016-09-09 11:33:06

can anyone explain,what error does it contain in python 3.5
x = int(input())
y = int(input())

if 0<x<200 and 0<y<200:
print(x+y)

anchises_1968: 2016-08-30 22:28:10

Thank you akashpreet. I eliminated any cout i.e. "Input", "Output" and it finally passed. Also using goto statement for numbers outside the range. I did it in C++.

twistedpear6: 2016-08-29 02:55:40

Can someone tell me why this code isn't compiling?
it doesn't like the " in " before "nexIint();"

System.out.println("please enter first number:");
int numa = in.nextInt();

System.out.println("please enter second number:");
int numb = in.nextInt();

akashpreet: 2016-08-28 18:55:29

Here is a Tip:
1)Don't use any print statements like "please enter the number" in your program.
2)Directly get the input and store it in a variable
3)For example if a program asks for an even number as a input then,
Don't do
print("enter even number")
even_number = scan()
what you have to do is just use scan statement
even_number = scan()

Shashi Shailaj: 2016-08-12 23:28:17

Changed the code to this .. and errr utput shows the correct results .. sill no idea why spoj says its wrong

#include<stdio.h>
int a=0,b=0,c=0;
int main()
{
printf("Input:\n");
scanf("%d\n%d",&a,&b);
printf("%d\n%d",a,b);
//scanf("%d\n",&b);
c = a + b;
printf("\nOutput:\n%d ",c);
return 0;
}

Shashi Shailaj: 2016-08-12 16:44:39

I have submitted the below C code but it says its wrong answer.
Its compiling fine with Visual Studio 2015 compiler . Even the error page on the Spoj site shows exactly desired output , yet it says that its wrong answer.

http://www.spoj.com/error/17491395

#include<stdio.h>
int a=0,b=0;
int main()
{
printf("Input a number less than 200:\t");
scanf("%d",&a);
printf("Input second number less than 200:\t");
scanf("%d",&b);
a = a + b;
printf("The sum of both is:\t %d ",a);
return 0;
}

sidch41: 2016-08-07 07:30:53

plz give ans thi que.

anand15: 2016-08-06 20:25:53

i have written code in python and its working but they say its not working .
now what should i do?
my code in python
num1 = int(input('Enter first number: '))
num2 = int(input('Enter second number: '))

def addNumber(num1 , num2 ):
if ((num1 > 200) or (num2 > 200)):
totalValue = "Please enter number less than 200"
else:
# Add both the parameters and return them."
totalValue = num1 + num2
return totalValue

# Now you can call addNumber function
total = addNumber( num1, num2 )
print("Total value :", total)

praveencs: 2016-08-04 11:23:45

gunhee-- you are writing code in python and not in c. ';' is not needed in python


Added by:kuszi
Date:2012-08-22
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64