Social Icons

Wednesday, 1 May 2013

Reverse Of a No.


#!/bin/sh

echo -n "Enter any no to find Reverse :  "
read  n
p=$n
rev=0
while [ $n -gt 0 ]
do
z=$(($n%10))
n=$(($n/10))
rev=$(($(($rev*10)) + z))
done
echo " .............reverse of the no. is : ........   : $rev"
exit 0
Output :



Factorial Of a No. Using Shell Program



#!/bin/sh
fact=1;
echo -n "Enter any no to find factorial :  "
read  n
for((i=1;i<=n;i++))
do
((fact=$fact * $i))

done

echo " .............factorial of the no. is : ........   : $fact"
exit 0


Shell Programming [If- Else]


#!/bin/sh
echo -n "Enter how many times you want to enter  :  "
read d
for((i=0;i<d;i++))
do
echo -n "Enter your age :  "
read n
if [ $n -gt 20 ] && [ $n -lt 50 ]
then
echo "...........you are middle aged men...................... "
elif [ $n -gt 5 ] && [ $n -lt 20 ]
then
echo "................you r a boy................"
else
 echo ".............you are a old man ............. "
fi
done
exit 0

Output:

Excuting Command in C program using "system" function


#include<stdio.h>
#include<stdlib.h>
int main()
{
printf("\n Showing Details of A file using System command : \n");


system("more first.txt");
return 0;


}



 

Sample Text

Sample text

 
Just Programming Cse DriveReputation Management