answersLogoWhite

0


Best Answer

which r the first 10 amstrong numbers??

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: To generate first 10 Armstrong numbers?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Write a java program to print the last digit in Fibonacci series?

Just generate the Fibonacci numbers one by one, and print each number's last digit ie number%10.


How do you write a program to print Armstrong numbers between 1 and 100 using for loop?

/*Program to find Armstrong number between 1 to N*/ int main() { int n = 0, remainder, sum = 0, i = 0, noDigits = 0, isArm = 0; char ch[60] = {0}; printf("Find the Arm Strong Numbers between 1 to N"); scanf("%d", &n); for(i = 1; i<n; i++) { isArm = i; itoa(isArm, ch, 10); noDigits = strlen(ch); while(isArm) { remainder = isArm%10; isArm=isArm/10; sum= sum+pow(remainder, noDigits); } if(sum == i) printf("\nArm Strong Nos are %d\n", i); sum = noDigits = 0; } }


Write a program in vbnet to find Armstrong numbers between 1 and 100?

class Armstrong{ public static void main(String args[]) { int num,rem,qub,sum=0,i; for(i=0; i<=999; i++) { num=i; sum=0; while(num>0) { rem=num%10; qub=rem*rem*rem; sum=sum+qub; num=num/10; } if(sum==i) { System.out.println("Print 1 to 1000 Armstrong Number",sum); } } } }


To find Armstrong number in java?

/*Program to find whether given no. is Armstrong or not. Example : Input - 153 Output - 1^3 + 5^3 + 3^3 = 153, so it is Armstrong no. */ class Armstrong{ public static void main(String args[]){ int num = Integer.parseInt(args[0]); int n = num; //use to check at last time int check=0,remainder; while(num > 0){ remainder = num % 10; check = check + (int)Math.pow(remainder,3); num = num / 10; } if(check == n) System.out.println(n+" is an Armstrong Number"); else System.out.println(n+" is not a Armstrong Number"); } }


Write a C program to print Armstrong numbers in a given range?

Sorry. I had to delete the older version, for it was written in C++, while the questioner had asked one in C. So here it is. In fact, I will give the questioner a bonus, it will print not only Armstrong numbers but all Narcissistic numbers (here the power to which the individual digits should be raised before being added to each other can be any integer. Clearly Armstrong numbers form a subset of these numbers, with the power equal to three), and that too not only upto 10000, but upto the maximum number a C compiler can process. Enjoy!#include#includemain(){int m=1,b;int a[200],i,j,k,l;while (m=1){a[i]=(b%10);b=floor(b/10);++i;}for (j=1;j=0;--l)k+= pow(a[l],j);if (k==m)goto sexy;}goto label;sexy: printf("%d (raise every digit to power of %d)\n",m,j);label: ++m;}}