#include<stdio.h>
#include<conio.h>
void arm(int a);
int main()
{
int a;
printf(" Enter a number
");
scanf("%d",&a);
arm (a);
getch();
return 0;
}
void arm(int a)
{
int b,sum,remainder;
b=a;
while (a>0)
{
remainder=a%10;
sum=sum+(remainder*remainder*remainder);
a=(a-remainder)/10;
}
if (b==sum)
{
printf("
It is armstrong number
");
}
else
{
printf("
It is not armstrong number
");
}
}
#include<stdio.h>
void main(){
int num, cNum, rem, sum;
printf("Enter a number = ");
scanf("%d",&num); //153
sum = 0;
cNum = num;
while(cNum != 0){
rem = cNum % 10;
sum = sum + (rem * rem * rem);
cNum = cNum / 10;
}
if(num == sum){
printf("Armstrong");
}
else{
printf("Not Armstrong");
}
}
#include<stdio.h>
void main(){
int num, cNum, rem, sum;
printf("Enter a number = ");
scanf("%d",&num); //153
sum = 0;
cNum = num;
while(cNum != 0){
rem = cNum % 10;
sum = sum + (rem * rem * rem);
cNum = cNum / 10;
}
if(num == sum){
printf("Armstrong");
}
else{
printf("Not Armstrong");
}
}
Code Example |
---|
C :: what is the use of malloc in c |
C :: relational operators in c |
C :: oracle trunc |
C :: check for duplicates c |
C :: c defined value sum |
C :: loops questions on c |
C :: c arrays and pointers |
C :: how to take input in c |
C :: what is O(N^2) in bubble sort method |
C :: national festivals of india in hindi |
C :: allintext:christie kiser filetype:log |
C :: cyrildewit laravel page view counter package. |
C :: how to only show tenths place in c |
C :: Answer to storing information in array |
C :: main prototype |
C :: can torch light bring change in chemical reaction |
C :: pointer operator |
C :: minimun number of moves in c |
C :: command line arguments to copy paste in c |
C :: bc1q9rfht42zayr3yvxqjw8tm6v3tkwl93t35gegxl |
C :: list fiter octobercms |
C :: variadic macros in c |
C :: sue murry |
C :: C Create union variables |
C :: how to turn off bash |
C :: c text modifiers |
C :: pthread_create |
C :: c make list |
Dart :: how to diable flutter for web |
Dart :: python change type of elements in list |