1.
Perform the Commands in Linux Shell the note the output in a file
date
date -u
date --date="2/02/2010"
date --date="Feb 2 2010"
date --date="2 year ago"
date --date="5 sec ago"
date --date="yesterday"
date --date="2 month ago"
date --date="10 day ago"
date --date="next tue"
date --date="2 day"
date --date="tomorrow"
date --date="1 year"
date "+%D"
date "+%D %T"
date "+%Y-%m-%d"
date "+%Y/%m/%d"
date "+%A %B %d %T %y"
2. Write a program to Check if an input number is positive or not.
3. Write a program to Check if an input number is positive, zero or negative.
4. Write a program to check whether a given number is even or odd.
5. Write a C program to read the age of a candidate and determine whether he is eligible to cast
his/her own vote.
6. Create a file in Linux and enter the following code:
echo “Enter a number”
read num
case $num in
[0-9])
echo “you have entered a single digit number”
;;
[1-9][1-9])
echo “you have entered a two-digit number”
;;
[1-9][1-9][1-9])
echo “you have entered a three-digit number”
;;
*)
echo “your entry does not match any of the conditions”
;;
Esac
Execute the above code and note your observations.
7. If a number is input through the keyboard, WASS to calculate sum of its digits. (for example if the
number is 369 then the output should be 3+6+9 = 18)
8. Write a Shell Script that computes the factorial of a given number.
9. Two numbers are entered through the keyboard. WAP to find the value of one number raised to
the power of another.
10. Write a program to create the following pattern
1 0
0 1 0
1 0 1 0
0 1 0 1 0
9.