C Program to find sum of two numbers
C Program to find sum of two numbers#include<stdio.h>int main(){ int a, b, sum; printf("\nEnter two no: "); scanf("%d %d", &a, &b); sum = a + b; printf("Sum : %d", sum); r...
An Armstrong number is a number that is equal to the sum of cubes of its digits.
#include<stdio.h>
int main(){
int n, i, sum = 0, temp;
printf("Enter a number: ");
scanf("%d", &n);
temp = n;
while (n != 0)
{
i = n % 10;
sum = sum + i * i * i;
n = n / 10;
}
if (sum == temp){
printf("%d is an Armstrong number", temp);
}
else{
printf("%d is not an Armstrong number", temp);
}
return 0;
}
// Input: 153
// Output: 153 is an Armstrong number