Professional Documents
Culture Documents
#include <string>
int main ()
{
int score = 0;
int score1 = 0, score2 = 0;
string team1 = "", team2 = "";
cout << "What is the score of" << team2 << " ? ";
cin >> score2;
if(score1 < 0 || score2 < 0){
cout << "ERROR: Score cannot be negative." << endl;
return -1;
}
else if(score1 == score2){
cout << team1 << " and " << team2 << " ARE TIED! " << endl;
else{
cout << team2 << " WON! " << endl;
}
return 0;
}
java.util.Scanner;
System.out.println("Enter a number:");
if(num % 2 == 0)
System.out.pintln(num + " is Even");
else
System.out.println(num + " is Odd");
}
}
import java.util.Scanner;
public class calculator{
public static void main (String[] args)
{
Scanner input1 = new Scanner(System.in);
System.out.println("*** CALCULATOR ***");
System.out.println("Enter 2 numbers:");
System.out.println("Choose Operation:");
int Choose=input1.nextInt();
if (Choose == 1)
System.out.println("Result-->"+ input + " + " + input2 + "=" + (input + input2 ));
else if(Choose == 2)
else if(Choose == 3)
System.out.println("Result-->"+ input + " * " + input2 + "=" + (input * input2 ));
else
System.out.println("Result-->"+ input + " / " + input2 + "=" + (input / input2 ));
}
}