I need to create a program using a for loop that will read in an integer, and print all the multiples of that integer up to 1000. e.g. given 7, will print 7, 14, 21, 28...(until the end)
This is what I have:
It seems to just be running an infinate loop.Code:#include <stdio.h> int main() { int a, b; printf("Enter in an integer:\n"); scanf("%d", &a); for (a = 1; a < 1000; b = a + a) printf("Your numbers are: %d.\n", b); return 0; }
Any help would be greatly appreciated.