السلام عليكم ورحمه الله::
اخباركم...
الدكتوره اعطتنا سؤال باستخدام لغه الجافا حليته بس يطلع لي خطا
والسؤال write program to implement arithamatic operation and accept the input from the keyboard use switch statment??
لوسمحتو شوفو ايش الخطا في هذا البرنامج؟؟؟
هذي محاولاتي
Import java.util.*;
public class arthimatic {
public arthimatic() {
}
public static void main(String args[]){
int a,b;
String operation ;
Scanner ob=new Scanner(System.in);
System.out.println("enter the operation");
operation =ob.nextline();
System.out.println("enter frist number ");
a=ob.nextInt();
System.out.println("enter second number");
b=ob.nextInt();
switch(operation)
{
case '+':
System.out.println("the sum=" +(a+b));
case '-':
System.out.println("the sub=" +(a-b));
break;
case '*':
System.out.println("the multip=" +(a*b));
break;
case '%':
System.out.println("the moud=" +(a%b));
break;
case '/':
System.out.println("the dvid+(a/b));
break;
default:
System.out.println("bad command");
}
}
}
واريد برنامج بالجافا يطبع الارقام كذا
1
22
333
انا كتبت برنامج يطبع هذي الارقام بس مايطلع زي كذا
تكون المخرجات
1
23
45
مادري ايش اسوي؟؟
ومشكوورين