Computer Science, asked by rp09102342489, 5 months ago

Write a C program to print Armstrong numbers
from 100 to 999.​

Answers

Answered by alokdwivedi053
0

Answer:

#include <stdio.h>

int main(void)

{

int i = 100, rem, sum, temp, tnum;

printf("The 3-digit Armstrong numbers are : ");

for ( ; i <= 999; i++)

{

tnum = i;

sum = 0;

while (tnum > 0)

{

rem = tnum % 10;

temp = rem * rem * rem;

sum = temp + sum;

tnum = tnum / 10;

}

if (i == sum)

printf("%d\n", sum);

}

getch

Similar questions