which r the first 10 amstrong numbers??
Just generate the Fibonacci numbers one by one, and print each number's last digit ie number%10.
/*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; } }
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); } } } }
/*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"); } }
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;}}
Armstrong Circle Theatre - 1950 The Numbers Racket 10-13 was released on: USA: 13 April 1960
By adding the differences of the previous two numbers.
The sum of the first 10 even numbers is 110.
The sum of the first 10 counting numbers (1-10) is 51.
The sum of the first 10 odd whole numbers is 100.
The sum of the first 10 natural numbers is 51, with an average of 5.1
Free credit card numbers are generated automatically with computer software that generate numbers that will comply with the MOD 10 algorithm or also knows as the Luhn algorithm.
The numbers 4, 6, 8, 9, 10, 12, 14, 15, 16, 18 are the first ten composite numbers.
The first ten positive numbers total 55.
An Armstrong is equal to 1*10^-10 metres
Benjamin Armstrong is 5' 10".
Emma Armstrong is 5' 10".