،
مسـآء الخير ،
مبروكـ قيرلز اللآبز آنتهت عقبال مانخلص كل المواد ،
،
أستاذة عظمة قبل شوية رسلت عالقروب نموذج من حل اختبار اليوم
في بعض الاشياء مختلفة ، دالة الماكسمم و دالة الإيكوال
كان موجود بدالهم الجذر التربيعي،
بالتوفيق ،،
كود PHP:
package sample;
import java.util.*;
public class FinalExam {
/
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("1-Factorial");
System.out.println("2-Addition");
System.out.println("3-Minimum");
System.out.println("4-Equal");
System.out.println("5-Maximum");
System.out.println("6-Multiplication Table\n");
String c;
do
{
Scanner in=new Scanner(System.in);
System.out.print("enter your choice:");
int x=in.nextInt();
while(x<1||x>6)
{
System.out.print("wrong answer ........... enter again:");
x=in.nextInt();
}
switch(x)
{
case 1: System.out.print("enter the number to find the factorial of:");
int z=in.nextInt();
int f=1;
for(int i=1; i<=z ;i++){
f*=i;
System.out.printf( "Factorial of %d\t is %d\n", i, f );
}
System.out.println();
break;
case 2:
System.out.print("enter first number:");
int a1=in.nextInt();
System.out.print("enter second number:");
int a2=in.nextInt();
System.out.println("The Addition="+( a1+a2) );
break;
case 6:
System.out.print("Which 'Multiplication Table' you want:");
int p1=in.nextInt();
for(int col= 1; col<=10;col++)
{
int ans =p1*col;
System.out.printf("%d * %d = %d \n", p1, col, ans );
}
System.out.println();
// System.out.print("The Result will be:"+ Math.pow(p1, p2));
break;
case 4:
System.out.print("enter first number:");
int e1=in.nextInt();
System.out.print("enter second number:");
int e2=in.nextInt();
if(e1==e2){
System.out.println("They are equal(==)");}
else
System.out.println("They aren't equal(!=)");
break;
case 5:
System.out.print("enter first number:");
int l1=in.nextInt();
System.out.print("enter second number:");
int l2=in.nextInt();
if(l1>l2)
System.out.println("The largest number is"+ l1) ;
else
System.out.println("The largest number is"+ l2) ;
break;
case 3:
System.out.print("enter first number:");
int m1=in.nextInt();
System.out.print("enter second number:");
int m2=in.nextInt();
if(m1<m2)
System.out.println("The smallest number is"+ m1) ;
else
System.out.println("The smallest number is"+ m2) ;
break;
}
System.out.print("do you want to continue?Yes_No):");
c=in.next();
}while(c.equalsIgnoreCase("Yes"));
System.out.print("Thanks for using my program");
}
}