Question 7 : Write a program in Java to print the sum of two numbers given by the user.
Java Program :
public class sum
{
public static void main(int a,int b)
{
int s;
s=a+b;
System.out.print("Sum = "+s);
}
}
Input :
a=10
b=20
Output :
Sum = 30
Java Program :
public class sum
{
public static void main(int a,int b)
{
int s;
s=a+b;
System.out.print("Sum = "+s);
}
}
Input :
a=10
b=20
Output :
Sum = 30
Good!
ReplyDeleteThis is the simplest programming I have ever seen.
ReplyDelete