public class TwoNumbers {
· public static void main(String args[]){
·
· int first_number = Integer.parseInt(args[0]);
· int second_number = Integer.parseInt(args[1]);
· int addition = first_number + second_number;
·
· if(args.length>2){
· }
· System.out.println("The sum is :"+ addition);
· }
· }
To do this you will need at least read permission; if you don't have that then you will not be able to execute the script at all. One way is to copy the script to your directory and add the execute permission. The second way is to call the correct shell interpreter program directly, as in: ksh /some/file/shell
#include<iostream.h> #include<conio.h> void main() { int a, b, c; clrscr(); cout<<"enter the two numbers"; cin>>a; cin>b; c=a+b; cout<<"Addition of two numbers="<<c; getch(); }
It is used for addition - to add two numbers. Also, to concatenate two Strings (texts) - that is, to make a longer text from two shorter ones.
package AddNumbers; public class AddNumbers { public static void main(String[] args) { int Int; int a = 4; int b=5 ; int sum = a + b; System.out.println("Addition of two numbers!"); System.out.println("Sum: " + sum); } }
#include<stdio.h> main() { int num1; int num2; int a; printf("Enter any two numbers :"); scanf("%d%d",&num1,&num2); for(a=num1;num1<=num2;a++) { if ( a % 2 == 1); { printf("%d",a); } } getch(); }
write ashell script to add awo matrix using array.
#!/bin/Bash echo "Enter the two numbers to be Multiplied:" read n1 read n2 answer=`expr $n1 \* $n2` echo $answer
To do this you will need at least read permission; if you don't have that then you will not be able to execute the script at all. One way is to copy the script to your directory and add the execute permission. The second way is to call the correct shell interpreter program directly, as in: ksh /some/file/shell
a=10; b=20; c=`expr $a + $b`; printf "$c";
#!/bin/sh # # add_2_numbers.sh # # Script provided by Alvin Abrahams - 07905 631 695. # # Seeking role as Unix Systems Administrator - Immediately available # # Assuming the two numbers are supplied to the script as parameters... # # The the variable add_sum will contain the result which is then displayed as below. # add_sum=`echo $1+$2|bc` echo ${add_sum} exit # Execution of script below. # ./add_2_numbers 3 4 7
It depends on the script language you are using. In the Korn shell, you can say: echo -n "Enter the first number: " read first echo -n "Enter the second number: " read second let third=$first+$second echo The answer is $third
Shell program to find LCM and hcf of two no.s tput clear echo "Enter first no" read a echo "Enter 2nd no" read b p= 'expr $a \* $b' while [$b -ne 0] do r= 'expr $a % $b' a=$b b=$r done LCM = 'expr $p / $a' echo "LCM = $LCM" echo "Hcf = $a"
Its indefinite: Start with 0,1 add last two numbers = 1 add to sequence = 0,1,1 add last two numbers = 2 add to sequence = 0,1,1,2 add last two numbers = 3 add to sequence = 0,1,1,2,3 add last two numbers = 5 add to sequence = 0,1,1,2,3,5 add last two numbers ......... add to sequence ..........
Add two numbers.
You must add either two odd numbers or two even numbers.
Add the two numbers and divide that by two.
when you add two or more numbers together, the result is called the sum