Make a program that prints out the first 8 multiples of a given integer y. Please use for loop.
Sample output:
Enter a number: 7
7 14 21 28 35 42 49 56
#include <stdio.h>
int main() {
int y;
int i;
printf("Enter a number: ");
scanf("%d", &y);
for (i=1; i<=8; i++) {
printf("%d ", i*y);
}
return 0;
}
Comments
Leave a comment