![]() |
# 1 |
משתמש - היכל התהילה
|
עזרה בהרצת קוד JAVA.
אני עובד עם eclipse, וכנראה ה - console לא עובד אצלי טוב.
הקוד הבא: קוד:
import java.lang.Math; import javax.swing.JOptionPane; public class hello { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub int a,b,c,m,f,f2,g,f3,f4; f = 0; a = Integer.parseInt(JOptionPane.showInputDialog("insert first number")); b = Integer.parseInt(JOptionPane.showInputDialog("insert sec number")); c = Integer.parseInt(JOptionPane.showInputDialog("insert third number")); m = ((b*b)* -(4)*(a*c)); g = (int)Math.sqrt((double)m); if (g > 0) { f = (-b + g)/(2*a) ; f2 = (-b - g)/(2*a); System.out.print("the first result is"); System.out.print(f2); System.out.print("the sec result is"); System.out.print(f); System.out.print("the equation is positive"); } if (g < 0) { f3 = (-b + g)/(2*a); f4 = (-b - g)/(2*a); System.out.print("the first result is"); System.out.print(f4); System.out.print("the sec result is"); System.out.print(f3); System.out.print("the equation is negative"); } } } תודה לעוזרים! |
חברים פעילים הצופים באשכול זה: 1 (0 חברים ו- 1 אורחים) | |
|
|