Print the First 3 multiples of the given number "N". (N is a positive integer)
Note: print the characters with a single space between them.
Answers
Answered by
2
Answer:
public class answer
{
public static void main(int N)
{
int i;
for( i = 0; i<=3; i++)
N = N*i ;
System.out.println(N +" ");
}
}
Answered by
0
A program to print the First 3 multiples of the given number "N" where N is a positive integer is written below:
Python Program:
number = int(input("Enter number: "))
print("The multiples are: ")
for i in range(1 , 4):
print(number * i, end = " ")
The output:
Enter number: 5
The multiples are:
5 10 15
- In the provided Python program, we accept the user-supplied number N as input and, in the event that the user enters a floating point number, convert it to an integer data type. Since input() returns a string rather than a number, the int() function call is required. Therefore, we must first convert it to a number if we want the mathematical operators to behave as expected. The print() function is then used, which displays the statement. The numerous are. The multiples in a range can be stored using the Python function range(). We need to execute a loop between 1 and 3 times in order to get the number's multiples.
To learn more:
https://brainly.in/question/35684003
https://brainly.in/question/6715558
#SPJ2
Similar questions