+ 1
Why this program not show output ??(for armstrong number from 1 to 100)
8 Respuestas
+ 3
#include <stdio.h>
int main() {
int i, n, num, d;
for (i = 1; i <= 100; i++) {
n = i;
num = 0;
while (n != 0) {
d = n % 10;
n = n / 10;
num = num + (d * d * d);
}
if (i == num)
printf("%d\n", i);
}
return 0;
}
your Programe having some indentation mistake
+ 1
How
+ 1
1 should've to print
+ 1
I got it thanks 🙏🏻
+ 1
Vaibhav thanks 🙏🏻
0
Because i is never equal to num in your code on line 15
0
Add the following line before line 15 and check output:
printf("i = %d, num = %d", i, num);
0
hmmm...idk,why is it doing that?