import java.io.*;
public class Arms
{
public static void main(String args[]) throws Exception
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter the number to be printed: ");
int n=Integer.parseInt(br.readLine());
int num,sum,r,temp;
System.out.println("Armstrong numbers upto given limit are:\n");
for(num=1;num<n;num++)
{
temp=num;
sum =0;
while (temp!=0)
{
r=temp%10;
sum=sum+(r*r*r);
temp=temp/10;
}
if(sum==num)
{
System.out.println(num);
}
}
}
}
Regards
Ramakrishna Nallapati
#include<limits.h> // defines CHAR_BIT
#include<math.h> // defines pow()
#include<stdio.h> // defines printf()
bool is_armstrong (const int n, const int b=10) {
// Returns true if n base b is narcissistic.
// Preconditions: n>=0, b>=2
int digit[sizeof (int) * CHAR_BIT]; // caters for all digits in all bases
int i, j, k; // local variables
i = 0; // count of digits (so far)
j = n;
while (j) {
digit[i] = j%b; // store least significant digit
j/=b; // shift-right by one digit
++i; // increment count
}
k = 0; // sum of all digits raised to the power of i
for (j=0; j<i; ++j) k+=pow (digit[j], i);
return k==n;
}
int main (void) {
for (int n=100; n<=999; ++n)
if (is_armstrong (n)) // base 10
printf ("%d ", n);
return 0;
}
Output:
153 370 371 407
/*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"); } }
import java.io.*; public class Jerry { public static void main(String as[]) throws IOException { int k=Integer.parseInt(as[0]); int n=k; int d=0,s=0; while(n>0) { d=n%10; s=s+(d*d*d); n=n/10; } if(k==s) System.out.println("Armstrong number"); else System.out.println("not Armstrong number"); } }
Get some resistors of known values and check your meter with them.
Range Check
/*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; } }
/*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"); } }
import java.io.*; public class Jerry { public static void main(String as[]) throws IOException { int k=Integer.parseInt(as[0]); int n=k; int d=0,s=0; while(n>0) { d=n%10; s=s+(d*d*d); n=n/10; } if(k==s) System.out.println("Armstrong number"); else System.out.println("not Armstrong number"); } }
write a shell program for finding out gcd of three given numbers? write a shell program for finding out gcd of three given numbers? write a shell program for finding out gcd of three given numbers? check bellow link http://bashscript.blogspot.com/2009/08/gcd-of-more-than-two-numbers.html
-12.5 and 13.5 Check: -12.5*13.5 = -168.75 and -12.5+13.5 = 1
<html> <head> <Script Language="JavaScript"> var a,n,b=0,t; n=parseInt(window.prompt("enter n","0")); t=n; while(n>0) { a=n%10; b=b+a*a*a; n=n/10; } if(b==t) { document.writeln("Armstrong no"); } else { document.writeln("Not an Armstrong no"); } </script> </head> </html>
i think he is 36. check wikipedia.
You will have to call Colt for anything after @ 2003. Check Blue Book of Gun values.
That depends on the specific make and model of your fax machine. Check your user's manual, or look on the manufacturer's website.
program would you run to check for possible disk errors
You will need to make a form with the following: - three input fields with IDs for the three numbers. Alternatively you may use one input and ask the user to separate the numbers with commas. - a button Let the button execute a function when clicked. This function will get the input fields' values using getElementById, check whether they are really numbers and then compare them. If you used the one textfield alternative, you will have to get the value, explode it at the commas and then check whether the values are correct and compare the numbers. As for comparing there are several possibilities. You could make decision trees with if-constructs or subtract the numbers from each other and check whether the result is >0. Then you could display the result in a previously empty p- or div-element.
check erid
i need a completly free vin check program