+ 1

Compiler is not showing some result

So i made a simple nth armstrong number program #include<iostream> #include<cmath> using namespace std; int armnum(int n); int countnum(int n); int countnum(int n){ int a=0; while(n>0){ n=n/10; a++; } return a; } int armnum(int n){ int sum=0,temp; temp=n; while(n>0){ sum=sum+pow(n%10,countnum(temp)); n=n/10; } return sum==temp; } int main(){ int f,l; cin>>f>>l; while(f<l){ if(armnum(f)){ cout<<f<<endl; } f++; } return 0; } (takes two input one input enter second input) (codeblock used) if i run this on MinGW compiler it misses some number like 153 (run code)which is a armstrong number but if i compile this online it give correct result. I have also tested using different program on mingw(thought mine was wrong) but it still missing some numbers. How to fix this?

23rd Aug 2019, 2:04 PM
Aditya Kumar
Aditya Kumar - avatar
1 Resposta
+ 1
I installed cygwin its working as it supposed to work
23rd Aug 2019, 3:18 PM
Aditya Kumar
Aditya Kumar - avatar