Tuesday, June 29, 2010

Add two numbers using java

This program will compute two numbers and get the sum.
a=90, c=80

program code:


import java.io.*;

public class compute
{
public static void main(String args[])
{
//Declaration of variables
int a=90;
int b=80;
int sum=0;

//compute the sum
sum=a+b;

System.out.print("The sum is" + sum);
}
}

No comments:

Post a Comment