Computer Science, asked by abhay1534, 1 year ago

write a program of Armstrong number

Answers

Answered by sam777
1

Check Armstrong Number:

#include <stdio.h>

#include <math.h>

int main()

{

int number, originalNumber, remainder, result = 0, n = 0 ;

 printf("Enter an integer: ");

scanf("%d", &number);

 originalNumber = number;  

while (originalNumber != 0)

{

originalNumber /= 10;

++n;

}

originalNumber = number;

while (originalNumber != 0)

{

remainder = originalNumber%10;

result += pow(remainder, n);

originalNumber /= 10;

}

 if(result == number)

printf("%d is an Armstrong number.", number);

else

printf("%d is not an Armstrong number.", number);

 return 0;

}


abhay1534: i need from bluej not from c+++
NSEJS: Thanks
Answered by Anonymous
3
hey mate ur answer is in attachment

hope it help u
Attachments:

Anonymous: gurnoor...sahi khe rahe h
NSEJS: Thik hai main khud hi khatam krr deti hoon
NSEJS: Bye
Similar questions