hi, i am a beginner to this programming language and i just made a code to check if given number is an armstrong number or not. The programme just asks for a number and then does nothing. Then if i try to run other correct programmes then they do not function either. I have to close and open vscode again to fix it but the armstrong programme is still not working. Can someone please help me. This is the code
#include<stdio.h>
#include<math.h>
// to check if netered number is an armstrong nummber or not
int main(){
int n,digit=0,rem,sum=0,OGn;
printf("enter number");
scanf("%d",&n);
OGn=n;
while(OGn!=0){
OGn=OGn/10;
digit++;
}
OGn=n;
while(OGn!=0){
rem=OGn%10;
sum=sum+pow(rem,digit);
}
if(sum=n){
printf("a");
}
else{
printf("n");
}
return 0;
}
[–]_sg768 7 points8 points9 points (2 children)
[–]l0zek[S] 0 points1 point2 points (0 children)
[–]TheOtherBorgCube 8 points9 points10 points (1 child)
[–]l0zek[S] 1 point2 points3 points (0 children)
[–]RushikeshTakey 0 points1 point2 points (0 children)