Ten Multiples

The program must accept a number and print it’s first ten multiples.

Example Input/Output 1:
Input:
3

Output:
3 6 9 12 15 18 21 24 27 30

Example Input/Output 2:
Input:
5

Output:
5 10 15 20 25 30 35 40 45 50

Python

N = int(input())
for ctr in range(1, 11):
print(ctr*N, end = " ")

Java

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

C

#include <stdlib.h>
#include  <stdio.h>
int main()
{
    int N;
    scanf("%d", &N);
    for(int ctr = 1; ctr <= 10; ctr++)
    {
        printf("%d ", N*ctr);
    }
    return 0;
}

C++

#include <iostream>
using namespace std;
int main()
{
    int N;
    cin >> N;
    for(int ctr = 1; ctr <= 10; ctr++)
    {
        cout << N*ctr << " ";
    }
    return 0;
}
Previous Article

Division - Two Values

Next Article

Hot Cold or Normal

Write a Comment

Leave a Comment

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