forked from gne-ldh/PPS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathp18.c
More file actions
17 lines (17 loc) · 776 Bytes
/
p18.c
File metadata and controls
17 lines (17 loc) · 776 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//PROGRAM TO CHECK WHETHER A NO. IS AN ARMSTRONG NUMBER OR NOT
#include<stdio.h> #include <math.h>
void main()
{
int number, sum = 0, rem = 0, cube = 0, original_no;
printf ("\nEnter a number::");
{
rem = number % 10;
cube = pow(rem, 3);
sum = sum + cube;
number = number / 10;
}
if (sum == original_no)
printf ("\nThe given no IS an ARMSTRONG no\n");
else
printf ("\nThe given no is NOT an ARMSTRONG no\n");
}