Posts

odd even etc

      EX.NO:3.hODD OR EVEN NUMBERS Aim: To Write a shell Program on whether a given number odd or even.   Algorithm: Step1: Declare the   variable A. Step2: Assign value to the variable Step3Perform A modulo 2 and check result if output is 0 Step4: If true print A is even Step5: If false print A is odd     Program Code:     . . . 0     Sample I/P: enter the no 5 Sample O/P: 5 is odd       RESULT: Thus the program was executed and verified successfully.   VIVA-VOCE QUESTIONS: 1. How do you determine odd and even?                       EX.NO:3. i LEAP YEAR Aim: To Write a shell Program on whether a given number leap year or not.   Algorithm: Step1: Declare the variable A. Step2: Assign value to the variable Step3: Check if year is divisible by 4 but n...

concatenation of two strings

  EX.NO : 3.f                         CONCATENATION OF TWOSTRINGS   Aim: To write a shell program to concatenate two strings.   Algorithm: Step1: Enter into the vi editor and go to the insert mode for entering the code Step2: Read the first string. Step3: Read the second string Step4: Concatenate the two strings Step5: Enter into the escape mode for the execution of the result and verify the output     Program code : echo “Enter the first string” readstr1 echo “Enter the second string” readstr2 echo “The concatenated string is” $str1$str2   Sample I/P:   Enter the first string: Hello Enter the second string: World   Sample O/P:   The concatenated string is HelloWorld   Result:   Thus the shell program to concatenate two strings is executed and output is verif...

maximum two number and three number

  EX.NO:3.d                     MAXIMUM OF TWONUMBERS   Aim: To write a shell program to find greatest of two numbers.   Algorithm:   Step1: Declare the two variables. Step2: Check if A is greater than B. Step3: If so print A is greater. Step4: Else B is greater   . Program code : clear echo " enter two no" Read a read b if [ $a -gt $b ] then echo "$a is greater" else echo "$b is greater" fi   Sample I/P: Enter two no 5   6   Sample O/P:   b is greater                               Result: Thus the shell program to find the maximum of three numbers is executed and output is verified successfully.   VIVA-VOCE QUESTIONS:   1. ...

Alphabet related program

EX.NO : 2.m PRINT EXIST FILE WHICH STARTING WITH SAME ALPHABET   Aim: Write a shell program to print existing file which starting with same alphabet.   Algorithm:   Step1: Start Step2:In a BASH, “for” loop all, the statements between do and done are performed once every item in the list. Each time the loop iterates, the next value in the list is inserted into the variable specified after the word for. In the below loop, the variable is called k. Step3: The echo statement displays information to the screen.All t file name in the list display one by one to the screen. Step4:Stop   Program code:   for k in t* do             echo "File name is $k" done   Sample O/P:   File name is t* File name is tt.sh File name is t1.sh   Result: Thus the shell program is executed and output is verified successful   VIVA-VOCE QUESTIONS:   1. ...