#include <stdio.h>
#include <conio.h>
main()
{
int n, sum = 0, temp, r;
printf( " Enter a number " );
scanf( " %d ", &n);
temp = n;
while( temp != 0 )
{
r = temp % 10;
sum = sum + r * r * r;
temp = temp / 10;
}
if ( n == sum )
printf( " Entered number is an armstrong number. " );
else
printf( " Entered number is not an armstrong number. " );
getch();
return 0;
}
OUTPUT:
Enter a number6
Entered number is not an Armstrong number.
ALSO READ:
-- Program To Print First Ten(10) Natural Numbers.
-- Program To Print Fibonacci Series Upto 100.
-- Program To Check Whether A Number Is Prime Or Not.
-- Program To Compute The Reverse Of A Number.
-- Program To Print A Semicolon Without Using A Semicolon.
-- Program To Display Function Without Using The Main Function.
-- Program To Print Any Print Statement Without Using Semicolon.
-- Program To Display Its Own Source Code As Its Output.
-- Program To Swap Two Strings Using strcpy() Function.
-- Program to accept a string and print the reverse of the given string.
-- Program To Get IP Address.
-- Program To Accept An Integer & Reverse It.
-- Program To Convert Given Number Of Days To A Measure Of Time Given In Years, Weeks & Days.
-- Program To Illustrate The Concept Of Unions.
-- Program To Find The Size Of A Union.
... Back To C++ Programs Index
... Back To C++ FAQ's Index
... Back To C Programs Index
... Back To C FAQ's Index
... Back To HR Interview Index
i want program for this output,if we enter 4352 means output will come like this
ReplyDelete4
4 3
4 3 5
4 3 5 2
In TCL
Deleteset a 4352
set spl [split $a ""]
set len [llength $spl]
for {set i 0} {$i <$len} {incr i} {
puts [lappend list [lindex $spl $i]]
}
set a 4352
Deleteset spl [split $a ""]
set len [llength $spl]
for {set i 0} {$i <$len} {incr i} {
puts [lappend list [lindex $spl $i]]
}