Print the Next Number

The program must accept a number and print its next number.

Example Input/Output 1:
Input:
5

Output:
6

Example Input/Output 2:
Input:
99

Output:
100

Python

N = int(input())
print(N+1)

Java

import java.util.*;
public class Hello {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        System.out.print(N + 1);
    }
}

C

#include <stdio.h>
#include  <stdlib.h>
int main()
{
    int N;
    scanf("%d",&N);
    printf("%d",N+1);
}

C++

#include <iostream>
using namespace std;
int main()
{
    int N;
    cin >> N;
    cout << N+1;
    return 0;
}

Leave a Reply

Your email address will not be published. Required fields are marked *

More posts. You may also be interested in.