. Accept a number and print the first five multiples of the number if the number is ending with 4.
pls answer it fast. will mark as brainliest
Answers
Answered by
2
Explanation:
How do I develop an algorithm to input any number and print the first five multiples of it?
You have to iterate a loop i from 1 to 5 and inside the loop you have to multiply i with the given number n and print the value each time.
C code :
#include<stdio.h>
void main()
{
int n,p,i;
printf("\nEnter a number : ");
scanf("%d",&n);
printf("\nThe first 5 multiples of %d is: \n",n);
for(i=1;i<=5;i++)
{
p=n*i;
printf("%d ",p);
}
}
output :
Enter a number : 5
The first 5 multiples of 5 is:
5 10 15 20 25
Algorithm :
Take number n as input
for(i=1;i<=5;i++) //as first five multiples are required
p=n*i;
printf("%d ",p);
end of loop
end of program
please mark me as brainliest and follow me I will follow u back
Similar questions