Os Lab
Os Lab
#!/bin/bash
OUTPUT
Enter the first number:
5
Enter the second number:
10
The sum of 5 and 10 is: 15
OUTPUT
3. Write a shell program to fine twin prime numbers between a given range.
#!/bin/bash
OUTPUT
Enter the starting number of the range:
10
Enter the ending number of the range:
50
Twin prime numbers between 10 and 50 are:
(11, 13)
(17, 19)
(29, 31)
(41, 43)
# Initialize variables
a=0
b=1
sum=0
OUTPUT
Fibonacci series from 1 to 10:
1 1 2 3 5 8 13 21 34 55
The sum of the Fibonacci series from 1 to 10 is: 143
5. Write a shell program to find the simple interest(si) , where principal(p),
time(t) and rate of interest(r) are user choice.
[Using this formula, si=(p*t*r)/100]
#!/bin/bash
OUTPUT
Enter the principal amount (P):
1000
Enter the time period in years (T):
5
Enter the rate of interest (R):
10
The Simple Interest (SI) is: 500