Write shell script to find factorial of a number.

1 Answer

Answer :

i=1

f=1

echo " Enter the number"

read n

while [ $i -le $n ]

do

f=`expr $f \* $i`

i=`expr $i + 1`

done

echo FACTORIAL = $f

output:

Enter the number

5

FACTORIAL=120

Related questions

Description : Write a shell script to accept a number from user check whether number is even or odd.

Last Answer : 2 8

Description : Write a shell script to accept length and breadth of rectangle from user. Calculate and display area, perimeter, of entered values using choice entered by user.

Last Answer : #!/bin/bash # GNU bash, version 4.3.46 echo "Enter Length of Rectangle: " read length echo "Enter Breadth of Rectangle: " read breadth echo "Which operation you want to perform? 1: area 2: perimeter" read ... ) res=` echo 2 \* $length \* $breadth | bc` ;; esac echo "Result is $res" exit 0

Description : Write a ‘C++’ program to find factorial of given number using loop.

Last Answer : #include<iostream.h> #include<conio.h> void main() { int no,fact=1,i; clrscr(); cout<<"Enter number:"; cin>>no; for(i=1;i<=no;i++) { fact=fact*i; } cout<<"Factorial ="<<fact; getch(); }

Description : If the value of a number (N) is entered through keyboard. Write a program using recursion to calculate and display factorial of number (N). 

Last Answer : #include<stdio.h> #include<conio.h> int factorial(int N); void main() { int N,fact; clrscr(); printf("Enter number:"); scanf("%d",&N); fact=factorial(N); printf( ... N) { if(N==1) return(1); else return(N*factorial(N-1)); }

Description : Is there a formula to find the factorial of a number?

Last Answer : n! = Gamma[n – 1].

Description : Calculate factorial of a number using recursion.

Last Answer : #include #include int factorial(int no) { if(no==1) return(1); else return(no*factorial(no-1)); } void main() { intfact,no; clrscr(); printf("\n Enter number"); scanf("%d",&no); fact=factorial(no); printf("\n Factorial number=%d",fact); getch(); }

Description : Develop a program to find factorial of a number using recursion.

Last Answer : #include<stdio.h> #include<conio.h> int factorial(int num) { if(num==1) { return 1;  } else { return(num*factorial(num-1));  } } void main() { int ... ;num); result=factorial(num); printf("Factorial of %d is %d",num,result); getch(); }

Description : If 4! = 1x2x3x4 and is called 4 factorial, what is the sum of the numbers e.g. 4(?)= (1+2+3+4) called?

Last Answer : What’s wrong with the summation notation? It does just that. I don’t think there’s any other way of expressing it other than writing it out. [addition]: After more research, I found a formula where 1+2+3+4….+n= n*(n+1)/2 http://en.wikipedia.org/wiki/Triangular_number

Description : What is 1000000 factorial divided by 999999 factorial?

Last Answer : 1

Description : The per capital income of India from 1950 to 1990 is four times. This study is (a) social (b) Factorial (c) Longitudinal (d) horizontal

Last Answer : (c) Longitudinal

Description : We use Factorial Analysis: (A) To know the relationship between two variables (B) To test the Hypothesis (C) To know the difference between two variables (D) To know the difference among the many variables

Last Answer : (C) To know the difference between two variables

Description : The question to be answered by factorial analysis of the quantitative data does not explain one of the following (A) Is X' related to Y' ? (B) How is X' related to Y'? (C) How does X' affect the ... levels of another independent variable K' or M' ? (D) How is X' by K' related to M'?

Last Answer : (D) How is ‘X’ by ‘K’ related to ‘M’?

Description : To test null hypothesis, a researcher uses: (A) t test (B) ANOVA (C) x 2 (D) factorial analysis

Last Answer : Answer: B  Analysis of variance (ANOVA) is a collection of statistical models used to analyze the differences among group means and their associated procedures (such as "variation" among ... "variation" among and between groups), developed by statistician and evolutionary biologist Ronald Fisher.

Description : ULSI stands for______ (A) Ultra Large Scale Integration (B) Ultimate Large Scale Integration (C) Upper Large Scale Integration (D) Ultra Large Script Integration

Last Answer : (A) Ultra Large Scale Integration

Description : Junk e-mail is also called _____: a) Spam b) Spoof c) Cookie Crumbs d) Sniffer Script e) Spill

Last Answer : a) Spam

Description : The first page of a website is called the _____: a) Homepage b) Index c) Java Script d) Bookmark e) Intro Page

Last Answer : a) Homepage

Description : The first page of a Web site is called the....... 1) Homepage 2) Index 3) java Script 4) Book Mark

Last Answer : 1) Homepage

Description : The amateur or newbie in the field of hacking who don’t have many skills about coding and in-depth working of security and hacking tools are called ________ a) Sponsored Hackers b) Hactivists c) Script Kiddies d) Whistle Blowers

Last Answer : d) Whistle Blowers

Description : Which type of hacker represents the highest risk to your network? A. Disgruntled employees B. Black-hat hackers C. Grey-hat hackers D. Script kiddies

Last Answer : A. Disgruntled employees

Description : Who are use their skill to identify security problem with computer network A)Black Hat Hacker B)Ethical Hacker C)Grey Hat hacker D)Script Kiddies

Last Answer : B)Ethical Hacker

Description : 0 White hat Hacker is known as the A)Cracker B)Ethical C)Grey Hat D)Script Kiddies

Last Answer : B)Ethical

Description : Banner grabbing is often used for……. a. White hat hacking b. Black hat hacking c. Gray hat hacking d. Script kiddies

Last Answer : a. White hat hacking

Description : Which type of hacker represents the highest risk to your network? A. Disgruntled employees B. Black-hat hackers C. Grey-hat hackers D. Script kiddies

Last Answer : D. Script kiddies

Description : hich is not the commonly used programming language for AI? ⮚ PROLOG ⮚ LISP ⮚ Perl ⮚ Java script

Last Answer : ⮚ Perl

Description : A non-skilled person who gains access to computer system using already made tools are known as? a. Grey hat hackers b. Hacktivist c. Script kiddies d. Phreakers

Last Answer : c. Script kiddies

Description : ) which type of hackers represent the highest risk to your network (a) black hat hackers (b) grey hat hackers (c) disgruntled employees (d) script kiddies

Last Answer : (c) disgruntled employees

Description : banner grabbing is often use for (a) white hat hacking (b) black hat hacking (c) gray hat hacking (d) script kiddies

Last Answer : (a) white hat hacking

Description : Banner grabbing is used for A. White Hat Hacking B. Black Hat Hacking C. Grey Hat Hacking D. Script Kiddies

Last Answer : A. White Hat Hacking

Description : Which type of hacker represents the highest risk to your network? A. Disgruntled employees B. Black-hat hackers C. Grey-hat hackers D. Script kiddies

Last Answer : A. Disgruntled employees

Description : The amateur or newbie in the field of hacking who don’t have many skills about coding and in-depth working of security and hacking tools are called ________ a) Sponsored Hackers b) Hactivists c) Script Kiddies d) Whistle Blowers

Last Answer : c) Script Kiddies

Description : Which type of hacker represents the highest risk to your network? ∙ A. Disgruntled employees ∙ B. Black-hat hackers ∙ C. Grey-hat hackers ∙ D. Script kiddies

Last Answer : A. Disgruntled employees

Description : Who are use their skill to identify security problem with computer network A)Black Hat Hacker B)Ethical Hacker C)Grey Hat hacker D)Script Kiddies

Last Answer : B)Ethical Hacker

Description : White hat Hacker is known as the A)Cracker B)Ethical C)Grey Hat D)Script Kiddies

Last Answer : B)Ethical

Description : Jar Jar Abrams and his entire team of hack writers have been killed by terrorists freedom fighters. You are put in charge of producing the next Star Trek movie. Who will you hire to direct, and who will you hire to write the script?

Last Answer : Warner Herzog. Vince Gilligan

Description : How to write a structural analysis of a script?

Last Answer : You should have a good introduction, explaining the environment and the characters.

Description : write a shell program to find out the avogadro number?

Last Answer : cho "Enter A Number :" read n r=n s=0 rem=0 while [ $n -gt 0 ] do rem=$(($n%10)) s=$(($s+$rem*$rem*$rem)) n=$(($n/10)) done if [ $r -eq $s ] then echo "The Number is Avogadro" else echo "The Number is Not Avogadro" fi

Description : What is C Shell (CSH) ?

Last Answer : C Shell (CSH) is a command shell for systems like Unix, originally created in 1986 as part of the Berkeley Software Distribution (BSD). CSH can be used interactively to access commands or shell scripts. This ... , kernel shell (KSH) and jade shell ( zsh) . The modern variant , tcsh, is very popular

Description : What is a shell: a) It is a hardware component b) It is a command Interpreter c) It is a part in computer d) None of The Above

Last Answer : b) It is a command Interpreter

Description : How can you tell what shell you are running on UNIX system?

Last Answer : You can do the Echo $RANDOM. It will return a undefined variable if you are from the C Shell, just a return prompt if you are from the Bourne shell, and a 5 digit random numbers if you are from the Korn shell. You could also do a ps -l and look for the shell with the highest PID.

Description : Compare between C shell and korn shell.

Last Answer : C shell Korn Shell Is slower than korn shell Is faster than the C shell. Command full-path name is /bin/csh. Command full-path name is /bin/ksh. Non-root user default ... line editing Command line editing End of if statement with endif End of if statement with fi 

Description : A type of internet account, in which the computer is not connected directly to the net. (1) Shell Account (2) Kernel Account (3) Server Account (4) TCP/IP Account

Last Answer :  TCP/IP Account

Description : ...............tag is an extension to HTML that can enclose any number of Javascript statements. (A)< SCRIPT> (B)< BODY> (C)< HEAD> (D)

Last Answer : Answer: A

Description : In surface condensers write role of (i) Water tubes (ii) Shell (iii) Baffle plate (iv) Tube sheet

Last Answer : Function of parts in surface condensers 1. Water tubes- Cooling water flows through it , for convective heat transfer to occur with steam outside the tubes 2. Shell- Outer body, all components are ... and improves heat transfer 4. Tube sheet- All tubes are supported at the end in tube sheet

Description : Lets flip the script: Picky eaters, what one food you CAN get behind?

Last Answer : Fries

Description : Windows script host error, can someone please help?

Last Answer : answer:Your Registry got mangled somehow and messed up your file associations. Given that one of them was .EXE that makes things a little more difficult, though not insurmountable. The simplest fix I ... with the Registry, which will make the necessary changes to get your system back up and running.

Description : Can someone please help me solve this windows 7 script host error?

Last Answer : If you still have the OS disc, I suggest booting into it and see if you can repair the system.

Description : If you could go back in time and make a change to the script of "Back to the Future", what would you change?

Last Answer : When Marty goes into the future, he sees that he is now a washed up actor with Parkinson’s.

Description : How can I make this sort of a ...script, in excel?

Last Answer : You could simply graph them on the same chart. Once the sheet is set up that’s about all that would need to be done. You would not have any fancy transparency though. I would probably just write a small program in Java to do it.

Description : Can I take my written script to another pharmacy and get it filled?

Last Answer : answer:The pharmacy doesn’t care; the insurance company does. If you’re paying out of your own pocket, you’re free to do whatever you want.

Description : Can someone read my script and tell me if it's any good?

Last Answer : Go ahead. I’m all ears. PM me, don’t post it as another question.