0
Plz check whether itâs wrong or right
To check itâs an Armstrong no. Or not using functions #include<iostream.h> Int check(int); Void main() {int n; char ch; Do{cout <<enter a noâ; Cin >>n; Int f=check(n); If (f==1) cout <<armstrong noâ; Else Cout<<ânot an armstrong noâ; Cout<<continue(y/n)?â; Cin>>ch; }while(ch==âyâ);} Int check (int a) {int dug, sum=0; x=a; While(a>0) {dig=a%10; Sum+= pow(dig,3); A=a/10; } If(x==sum) Return 1; Else Return 0;}
1 Answer
+ 2
Have you tried to run this in Playground?
Have you tried to find a list online with Armstrong numbers to compare your results?
If they came out wrong, what were your attempts so far to find the issues?