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;}

24th Nov 2018, 1:17 PM
Shreya
1 Réponse
+ 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?
24th Nov 2018, 2:45 PM
HonFu
HonFu - avatar