I wrote this program to ask the user to give an integer number and then the program will check whether the given integer number is an Armstrong number or not using C programming language.
My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.
My mobile number here in the Philippines is 09173084360.
My telephone number at home here in Bacolod City, Negros Occidental Philippines is +63 (034) 4335675.
Here in Bacolod City, Negros Occidental I also accepting computer repair, networking and Arduino Project development at a very affordable price.
My Facebook address is https://www.facebook.com/profile.php?...
My personal website is http://www.jakerpomperada.com
My programming website is http://www.jakerpomperada.blogspot.com
I am also a book author you can purchase my books on computer programming and information technology in the following links below.
https://www.mindshaperspublishing.com/
https://www.unlimitedbooksph.com/
Thank you very much for your help and support.
Sample Program Output
Program Listing
/* armstrong.c
Author : Jake R. Pomperada,MAED-IT
Date : November 22, 2019
jakerpomperada@gmail.com */
#include<stdio.h>
int main()
{
int n=0, sum=0, t=0, remainder=0;
printf("\n\n");
printf("\tArmstrong Number Solver in C");
printf("\n\n");
printf("\tEnter a Number : ");
scanf("%d",&n);
t = n;
while( t != 0 )
{
remainder = t%10;
sum = sum + (remainder*remainder*remainder);
t = t/10;
}
printf("\n\n");
if (n == sum) {
printf("\tThe number %d is an armstrong number", n);
}
else {
printf("\tThe number %d is not an armstrong number", n);
}
printf("\n\n");
printf("\tEnd of Program");
}
No comments:
Post a Comment