GeekInterview
|
Geeks Forum
|
Online Quiz
|
Learning Center
|
Privacy
|
Terms and Conditions
|
Contact
Home
>
Code Samples
>
C/C++
> Check for armstrong number
Check for armstrong number
Description:
To check whether a number is armstrong number or not
Date added:
16 September, 2007
Submitted By:
Priya
Rating:
0
Download:
N/A
Instructions:
To check whether a number is armstrong number or not
Source Code:
/* To check whether a number is armstrong number or not */ #include #include #include void main() { int i,n,r,f,sum=0; clrscr(); printf("Enter a no.n"); scanf("%d",&n); f=n; while (n>0) { r=n%10; n=n/10; sum+=pow(r,3); } if (sum==f) printf("%d is an armstrong no.n",f); else printf("%d is not an armstrong no.n",f); getch(); }
WidgetBucks - Trend Watch - WidgetBucks.com
Comments
[
Leave Comment
]
Your name:
E-mail (optional):
Text:
Please enter code
shown on image:
No comments posted yet. Be the first one to comment.
Tips
[
Leave Tip
]
Your name:
E-mail (optional):
Text:
Please enter code
shown on image:
No tips added yet. Be the first one to share tip.
Reviews
[
Leave Review
]
Your name:
E-mail (optional):
Rate:
1
2
3
4
5
6
7
8
9
10
Text:
Please enter code
shown on image:
No reviews added yet. Be the first one to review.
Tags
code
Related Categories
Oracle » Database » C/C++
DB2 » Database » C/C++
MYSQL » Database » C/C++
SQL Server » Database » C/C++
Code Samples » C/C++
Copyright @
GeekInterview.com