Skip to main content

Posts

Showing posts with the label java basic

ads1

Java Programming||Write a Java Program to enter two numbers and find their sum.

                                                           JAVA Program                            Static Program  :- 1. Write a Java Program to enter two numbers and find their sum. class sum { public static void main(String args[]) { int a=10; int b=20; int c = a+b; System.out.println("The Sum of two number is :- "+c); } } Output :-  Dynamic  :-  import java.util.*; class sum { public static void main(String args[]) { Scanner in = new Scanner(System.in); System.out.println("Enter the first number :- "); int a=in.nextInt(); System.out.println("Enter the Second number :- "); int b=in.nextInt(); int c = a+b; System.out.println("The sum of two number is :- "+c); } } Output :- 

ads2