Print the Previous Number

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

Example Input/Output 1:
Input:
68

Output:
67

Example Input/Output 2:
Input:
100

Output:
99

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 number;
    scanf("%d", &number);
    printf("%d", number - 1);
}

C++

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

Print the Next Number

Next Article

Two Numbers Equal

Write a Comment

Leave a Comment

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