The original question is this way:
This is a very simple topic, designed to examine your basic ability to program. Don't think it's hard. Enter a row that includes three integers, a, B, and C separated by a space (the data range is between -40~40). The output is one row, the result of the "a+b+c" calculation.
Sample 1
Input:
22 1 3
Output:
26
Since I have just come in contact with Python, so the code is a bit long, I hope there is great God can point out, help me improve, I am grateful. Let's start with my code, in the order of Java, C, Python
Java:
Import Java.util.Scanner;
Class Main
{public
static void Main (string[] args)
{
int a,b,c;
Scanner input=new Scanner (system.in);
A=input.nextint ();
B=input.nextint ();
C=input.nextint ();
if ((a>=-40&&a<=40) && (b>=-40&&b<=40) && (c>=-40&&c<=40) )
System.out.println (a+b+c);
else
System.out.println ("Erro");
}
C Language:
#include <stdio.h>
int main (void) {
int A, b, C;
scanf ("%d%d%d", &a, &b, &c);
if (A > | | A < -40 | | b > | | | b < -40 | | c > | | | c < -40) return
0;
printf ("%d", a+b+c);
return 0;
}
Python:
LST = Raw_input (). Split (")
sum = 0 for
i in LST:
sum = sum+int (i)
print sum
As for other languages, such as what C++/ruby, not yet. Just a little bit of the three languages posted. Also hope to master a lot of advice.