#include <stdio.h>
int main() {
int num1;
printf("Enter a number: ");
scanf("%d", &num1);
int count = 1;
while (count = 10) { //Why does this return an infinite loop?
int product = count * num1; //Why won't it stop since count will only be equals 10 once?
printf("%dn", product);
count++;
}
return 0;
}
//P.S. I understand that the error can be fixed by changing the count = 10 into count <=10
I tried to run it and the result will be infinite loop.
For example, if I input 9, the result will be.
90
90
90
…
infinitely!
New contributor
Star_Dust is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.