0% found this document useful (0 votes)
17 views

Linux Algorithm 2

Uploaded by

abdul.king1810
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Linux Algorithm 2

Uploaded by

abdul.king1810
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Shell Script Date Format

Aim:

To write a shell Script to display the date,time,username and Current Directory.

Algorithm:

Step1:Start

Step2:To set the date in shell using the date command line on Unix and macOS, you do not need any
options.

step3: By default the datetime format needs to be [[[mm]dd]HH]MM[[cc]yy]

Step4: stop

5.

Aim:

To Write a shell script to find the sum of digits of a given number.

Algorithm:

Step1. Get a number

Step2. Split each digit from the number using modulo operator.

Step3. Calculate the sum

Step4. Print the result.

7.

Aim:

To Write a program to check whether given string is palindrome or not


Algorithm:

Step1: start

Step2: Input the string.


Step3:Find the reverse of the string.

Step4:If the reverse of the string is equal to the input string, then return true. Else, return false.

Step5:stop

8.

Aim:

To Write a shell script to find factorial of a given integer.

Algorithm:

Step1: Start

Step2:Get a number

Use for loop to compute the factorial by using the below formula

fact(n) = n * n-1 * n-2

Step3: Display the result.

Step4:Stop

9.

Aim:

To Write a shell script to generate mark sheet of a student.

Algorithm:

Step1:Start

Step2:mark- sheet of a student.

Step3: Take 3 subjects, calculate and display total marks, percentage

Step4: Stop

You might also like