Attribution Non-Commercial (BY-NC)

2.3K views

Attribution Non-Commercial (BY-NC)

- 04. GE2115_Computer_Practice_Laboratory_II_UNIX _Shell_Programming
- 93205249 GE2155 Computer Practice Lab II Shell Programming
- Ge2155 Work Book
- Semester 2 Lab Manual 1
- Cp 2 Lab Manual Final
- Set I - GE2155 - Anna Univ
- 54980763-C-Programs
- SET 1,2,3 Ge2155 Lab Question
- The Subtle Art of Not Giving a F*ck: A Counterintuitive Approach to Living a Good Life
- Sapiens: A Brief History of Humankind
- Hidden Figures: The American Dream and the Untold Story of the Black Women Mathematicians Who Helped Win the Space Race
- Shoe Dog: A Memoir by the Creator of Nike
- The Unwinding: An Inner History of the New America
- The Little Book of Hygge: Danish Secrets to Happy Living
- Never Split the Difference: Negotiating As If Your Life Depended On It
- Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future
- Yes Please
- A Heartbreaking Work Of Staggering Genius: A Memoir Based on a True Story
- Grit: The Power of Passion and Perseverance
- Devil in the Grove: Thurgood Marshall, the Groveland Boys, and the Dawn of a New America

You are on page 1of 3

PROGRAM echo "Enter the first number:"read aecho "Enter the second number:"read becho "Enter the third number:"read cif [ $a -gt $b -a $a -gt $c ]thenecho "$s is greater"elif [ $b -gt $c ]thenecho "$b is greater"elseecho "$c is greater"fi OUTPUT -bash-3.2$ sh larthree.shEnter the first number:20Enter the second number:30Enter the third number:1030 is greater-bash-3.2$ 26. Write a Shell program to find the largest among n different numbers.PROGRAM echo "Enter the number of elements:"read nl=0for((i = 1 ; i <= n ; i++))doecho "Enter the number:"read noif [ $no -gt $l ]thenl=$nofidoneecho "The largest numbers is : $l"

OUTPUT -bash-3.2$ sh largest.shEnter the number of elements:5Enter the number:44Enter the number:55Enter the number:33Enter the number:22Enter the number:11The largest numbers is : 55

27. Write a Shell program to find the largest digit of a number.PROGRAM echo "Enter a number:"read ns=0while [ $n -gt 0 ]dor=`expr $n % 10`if [ $r -gt $s ]thens=$rfin=`expr $n / 10`doneecho "The largest digit is : $s" OUTPUT -bash-3.2$ sh large.shEnter a number:143The largest digit is : 4-bash-3.2$ sh large.shEnter a number:786The largest digit is : 8

Write a Shell program to find the sum of n different numbers.PROGRAM echo "Enter the number of elements:"read ns=0for((i = 1 ; i <= n ; i++))doecho "Enter the number:"read nos=`expr $s + $no`doneecho "The sum is : $s" OUTPUT -bash-3.2$ sh sum.shEnter the number of elements:5Enter the number:11Enter the number:22Enter the number:33Enter the number:44Enter the number:55The sum is : 165

Write a Shell program to find the sum of digits of a number.PROGRAM echo "Enter a number:"read ns=0while [ $n -gt 0 ]dor=`expr $n % 10`s=`expr $s + $r`n=`expr $n / 10`doneecho "The sum of digit is : $s"

-bash-3.2$ sh sumdigit.shEnter a number:14The sum of digit is : 5-bash-3.2$ sh sumdigit.shEnter a number:1983The sum of digit is : 21

30. Write a Shell program to print the reverse of a number.PROGRAM echo "Enter a number:"read nt=$ns=0while [ $n -gt 0 ]dor=`expr $n % 10`s=`expr $r + $s \* 10`n=`expr $n / 10`doneecho "The reverse of the number $t is $s" OUTPUT -bash-3.2$ sh revnum.shEnter a number:123The reverse of the number 123 is 321

31. Write a Shell program to find the factorial of a number using for loop.PROGRAM echo "Enter a number:"read nf=1for((i = 1 ; i <= n ; i++))dof=`expr $f \* $i`doneecho "The factorial of $n is $f"

32. Write a Shell program to generate Fibonacci series.PROGRAM echo "Enter the number of terms:"read necho "Fibonacci series is:"a=-1b=1c=0for((i = 1 ; i <= n ; i++))doc=`expr $a + $b`echo $ca=$bb=$cdone OUTPUT -bash-3.2$ sh fibonacci.shEnter the number of terms:5Fibonacci series is:01123

- 04. GE2115_Computer_Practice_Laboratory_II_UNIX _Shell_ProgrammingUploaded byNarayana Swamy
- 93205249 GE2155 Computer Practice Lab II Shell ProgrammingUploaded byVaishali Ramkumar
- Ge2155 Work BookUploaded byfelieju
- Semester 2 Lab Manual 1Uploaded byBharad Waj
- Cp 2 Lab Manual FinalUploaded byvillixyloo
- Set I - GE2155 - Anna UnivUploaded bySan Kar
- 54980763-C-ProgramsUploaded byAravinth Karthik
- SET 1,2,3 Ge2155 Lab QuestionUploaded byGayathri Harini

- Nanocalsium Characterization of Cakalang Fish Bone Flour (Katsuwonus Pelamis L)Uploaded byInternational Journal of Innovative Science and Research Technology
- Solomon AUploaded bySanchayanBalachandran
- Synthesis and Characterization of Fused Rings from Mannich BasesUploaded bykawtherahmed
- Cracks and Crack Control in Concrete StructuresUploaded byErkan Şamhal
- MFP-BRK-E65-IHKA-enUploaded byFemdin01
- Convection PptUploaded byVinoth Malaikani
- Leakage Current and Common Mode VoltageUploaded byIoan Ţilea
- 23. Language Games and Related AreasUploaded byOpa Yat
- Chem 1Uploaded byRonnith Nandy
- Gustav Mie TheorieUploaded byjuan
- (13)SoundUploaded bymamannish7902
- Nitro Nic 60 BookUploaded byGerman Toledo
- Spatial DatabaseUploaded byGianni Gorgoglione
- 1-Chap Electric Charge and FieldUploaded bymanish kant nagar
- Implementation and analysis of the effects of white balance and light source to imagesUploaded byFloyd Willis Patricio
- Chapter 9_ Sources of the Magnetic FieldUploaded byPhuc Huy Nguyen Phuong
- C.G. Granqvist Eds. Materials Science for Solar Energy Conversion SystemsUploaded bymedelaid
- Smart Closet 1Uploaded bysharath
- Experimental-Investigation-of-Indirect-Field-Oriented-Control-of-Field-Programmable-Gate-Array-Based-Five-Phase-Induction-Motor-Drive.pdfUploaded byanunila
- Final PreliminaryUploaded byRaymund Arcos
- AAA RPD 004 A Support A By DR GHANIUploaded byMohsin Habib
- Introduction to Enhanced Oil RecoveryUploaded byThe PieonicBritz
- Crane 2E6PUploaded byhernandez15
- Orion Electronics Ltd. GPS Technical Reference GuideUploaded byjimdigriz
- Introduction to Basic Manufacturing Processes and Workshop TechnologyUploaded byMuhammad Zamurd Shehzad
- ANALOG AND DIGITAL COMMUNICATION TWO MARK WITH ANSWERUploaded byPRIYA RAJI
- Cauchy–Schwarz Inequality - WikipediaUploaded byMarlos
- control valve selectionUploaded byJitendra Sharma
- Effects of Warm-mix Asphalt Additives on Asphalt Mixture CharacteUploaded byFernandoAntonioAlvarezPacheco
- 4-Earth pressure theories.pdfUploaded byRanjan Lal