For her math homework, Alice is given problems that ask her to add 1 to the numbers she is given. Unfortunately (very unfortunately), Alice does not know how to add.
Help Alice by writing a program that takes in one number from the input, adds 1 to it, and outputs the result.
Input Format
The input contains one and only one integer: . (Note: We do not mention the number of test cases since this problem only has one test case).
If you're not too familiar with how to parse input or print output, a quick Google search might be helpful (or you can take a look at the sample programs below). Remember not to print any prompts like "Enter a number" or "The answer is" in your program. The grader will get confused by these prompts, and your solution may be marked as wrong!
Here is some source code for all 3 languages to help get you started. All the programs below store the integer into a variable, and they output the same integer back.
Java (Don't use the package statement, and make sure the class name is the same as the problem name)
import java.util.Scanner;
public class PRB1 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
System.out.println(N);
}
}
Python 3
N = int(input())
print(N)
C++
#include
using namespace std;
int main() {
int N;
cin >> N;
cout << N << endl;
return 0;
}