CFanatic

Go Back   CFanatic > Programming > C++ Programming

Join CFanatic Forum Now

Armstrong number or not ? topic posted under C++ Programming which is a part of Programming category in CFanatic Forum
Reply
 
Thread Tools Display Modes
  #1  
Old 12-30-2008, 12:20 AM
Member
 
Join Date: Dec 2008
Posts: 48
Thanks: 0
Thanked 1 Time in 1 Post
hkp819 is on a distinguished road
| More
Armstrong number or not ?

hello friend I am learning c++.
I want to create program to write to find a given number is Armstrong number or not ?
Reply With Quote
  #2  
Old 12-30-2008, 08:23 AM
Senior Member
 
Join Date: Jul 2008
Posts: 101
Thanks: 0
Thanked 0 Times in 0 Posts
xpi0t0s is on a distinguished road
| More
Re: Armstrong number or not ?

OK, so how would you do it on paper? Is 23 an Armstrong number? Why or why not? Show your working. You can then use that working to determine an algorithm, and from that you can write the program.
Reply With Quote
  #3  
Old 01-10-2010, 10:33 PM
Junior Member
 
Join Date: Jan 2010
Location: Nagpur, Maharashtra, India
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
rohitphulsunge is on a distinguished road
| More
Re: Armstrong number or not ?

armstrong number is that number which is equal to the sum of the individual digit's cube
Reply With Quote
  #4  
Old 01-13-2010, 06:02 AM
Banned
 
Join Date: Jan 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
debrah.h48 is on a distinguished road
| More
Re: Armstrong number or not ?

Hello,

Try this
Code:
main()

{

int amm 0 temp 0 n x;

printf( enter thealue of n );

scanf( d &n);

x n;

for(;n>0;)

{

temp n 10;

amm amm+(temp*temp*temp);

n n/10;

}

if(x n)

{

printf( THE GIVEN NUMBER IS AMSTRONG NUMBER );

}

else

printf( NOT AMSTRONG NUMBER );

}
Reply With Quote
  #5  
Old 01-13-2010, 06:31 AM
Junior Member
 
Join Date: Jan 2010
Location: Nagpur, Maharashtra, India
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
rohitphulsunge is on a distinguished road
| More
Re: Armstrong number or not ?

Rohit Phulsunge says-
Yes the above code for armstrong number would work
..!!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Help Displaying the largest Number Travis876 C# Programming 5 07-20-2009 02:23 AM
How to implement CSystem_Tray class with minimum number of lines of code ranjini.sg Win32 Programming 3 06-27-2007 03:43 AM

 

Advertisement

CFanatic Search
Custom Search

Advertisement

All times are GMT -5. The time now is 01:13 AM.



Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO ©2010, Crawlability, Inc.
Cfanatic.com is a premier member of the IDG TechNetwork. For advertising opportunities contact here
Get Paid for Working on Projects Matching Your Expertise at Go4Expert's Jobs Board