-->

حل الـ Assignment#1

Scanner input = new Scanner(System.in);
int n = input.nextInt();
int d = n/12;
int r = n%12;
System.out.println(d);
System.out.println(r);


~~~

2- Pythagorean Theorem


Scanner input = new Scanner(System.in);
double m = input.nextDouble();
double n = input.nextDouble();
		
double a = Math.pow(m, 2)-Math.pow(n, 2);
double b = 2*m*n;
double c = Math.sqrt(Math.pow(a, 2)+Math.pow(b, 2));
		
System.out.println(a);
System.out.println(b);
System.out.println(c);

~~~

 3- Resistance (simplify)
 
Scanner input = new Scanner(System.in);
double R1 = input.nextDouble();
double R2 = input.nextDouble();
		
double s = R1 + R2;
double p = 1/R1 + 1/R2;
double Req = 1/p;
		
System.out.println(s);
System.out.println(Req);


 ~~~

 4- Count Change



Scanner input = new Scanner(System.in);
int quarter = input.nextInt();
int dime = input.nextInt();
int nickel = input.nextInt();
float cent = input.nextFloat();
		
float dollar = (quarter*25 + dime*10 + nickel*5 + cent)/100;
		
System.out.println(dollar);


  ~~~

5- Strings

String input = "\"Somewhere over / the vast ocean \\ \'there must\' be a land\n"+
"where my thoughts / will meet the distant shore ...\"\n"+
"complained a \"lonely and longing\" singer.";
		
System.out.println(input);


~~~

 6- Stars


		
System.out.println("*****    ******    ******    ******");
System.out.println("*       *      *   *     *   *     ");
System.out.println("*      *        *  *      *   *****");
System.out.println("*       *      *   *     *   *     ");
System.out.println("*****    ******    ******    ******");




ليس هنالك تعليقات :

إرسال تعليق

جميع الحقوق محفوظة لموقع © Elmohandes

تصميم : مصطفى صلاح