- we have to declare to three variables in the program.
- we initiate the values of any two variable.
- now store the sum of these two variables in into the third variable.
the example of this program in Java can be seen as:
public class addtwonumbers{
public static void main(string[] args){
int a=5,b=6,sum;
sum=a+b;
System.out.println("sum of two numbers is \t" +sum);
}
}
output of this c program will be : sum of two numbers is 11
No comments:
Post a Comment