C/factorial and fibonacci
Expert: Joydeep Bhattacharya - 12/6/2007
QuestionQUESTION: how can i use functions in C for factorial and fibonacci of the number entered by the user?pls help me..need it tom morning.thanks..
ANSWER: Hi Dimples
Check this two link this mighty be a handy one for tommorow and in case you have problem with the logic do lemme know
Factorial
http://www.scodz.com/ViewProgram.php?uid=3&link=23
Fibonacci
http://www.scodz.com/ViewProgram.php?uid=5&link=74
regards
Joydeep Bhattacharya
http://www.scodz.com
---------- FOLLOW-UP ----------
QUESTION: hi there joydeep..i have a follow up question on factorial.what would i do for the series to be show.meaning..if user entered 5 it will show 1*2*3*4*5 = 120.how's that?and if a negative number was entered by the user, it will show error instead.what do i need to add to those sample codes that you sent me?pls reply as soon as you can for i badly need this after 10 hours.thank you very much..
AnswerHi Dimples
Here is the entire program for you and I am very sorry dear, for late reply I know this might be late when you get this program.
#include<stdio.h>
void main()
{
int no, i, fact = 1;
printf("Enter a no: ");
scanf("%d",&no);
if(no>0)
{
printf("1");
for(i = 2 ; i<=no ; i++)
{
printf(" X %d",i);
fact = fact * i;
}
printf(" = %d",fact);
}
else
printf("Error !");
getch();
}
From now onward when you need any program simply send me a mail at joydeep1982@gmail.com. Sorry once again
regards
Joydeep Bhattacharya
http://www.scodz.com