import java.util.*;
public class firstadd {
/**
* @param args
*/
public static void main(String[] args) {
Random rnd = new Random();
int num1 = rnd.nextInt(10);
int num2 = rnd.nextInt(10);
Scanner sc = new Scanner(System.in);
System.out.print(num1 + " plus " + num2 + "= ");
int result = sc.nextInt();
if(result == (num1+num2))
System.out.print("You're correct!");
else
System.out.print("You're wrong!");
}
}
this is my second class
import java.util.*;
public class firstsubtraction {
/**
* @param args
*/
public static void main(String[] args) {
Random rnd = new Random();
int num1 = rnd.nextInt(10);
int num2 = rnd.nextInt(10);
Scanner sc = new Scanner(System.in);
System.out.print(num1 + " minus " + num2 + "= ");
int result = sc.nextInt();
if(result == (num1-num2))
System.out.print("You're correct!");
else
System.out.print("You're wrong!");
}
}
*** MOD EDIT: Added code tags. Please
This post has been edited by JackOfAllTrades: 13 December 2009 - 04:11 PM

New Topic/Question
Reply




MultiQuote



|