I imported a class with the import java.util.Scanner;
it seemed a little awkward to do in java, so used to C.
import java.util.Scanner; // class scanner gets imported public class addition { public static void main(String [] args ) { Scanner input = new Scanner(System.in); int number1; //first number to add int number2; //second number to add int sum; // sum of number1 and number2 System.out.print("Please enter first interger: "); // prompt number1 = input.nextInt(); //read first number from user System.out.print("Please enter second interger: "); // prompt number2 = input.nextInt(); // read second number from user sum = number1 + number2; // add numbers, store total in sum System.out.printf("Sum is %d\n", sum ); // display sum } // end of main string }// end of class addition
I always had a passion for the field of STEM (Science, Technology, Engineering, and Math) and I knew I wanted to do something to make a difference in the world. I just didn’t know where to start. I was an immigrant in a new country, grew up in a tough environment, and wasn’t sure how… Read More