its_tru_its_damm_tru replied: "1a. is square of natural numbers
1.b. is given by formula
a=1,b=1
print a
a=a+b
b++
repeat from second line
1.c. is given by formula
a=1;
print a
a=a*2
repeat
2. fibonocci
in this a=1,b=1 is set
now print a
set a=b
b=a+b
repeat from second line
3 and 4 u have formula now implement them"
Can anyone please help me in making a program in TURBO C!! URgenT!!? can u please send me the format on how to do this questions in turbo C. i really need it for the finals.!!
Programming Problems:
1. Create a program that will determine the factorial of the inputted number.
2. Write a program that will read 10 numbers and will print the average, maximum and minimum values.
3. Write a program to read in numbers until the number -999 is encountered. The sum of all numbers read should be printed out.
[please send me the format so that i can pass it tomorrow morning.! all I'm gonna do is copy it. please i really need help on this.!
Note: this is done only in turbo C.]
Turbo c++ 3.0 help? Can someone help me to make a program that compute the factorial.
#include plx.. XD
pıʌɐſ replied: "#include
using namespace std;
int main()
{
int number=0;
int fact = 1;
cout << "Enter your number; ";
cin >> number;
for (int i=1 ; i <= number ; i++) { fact *= i;}
cout << "The factorial is: " << fact;
return 0;
}"
khazanchi replied: "#include
void factorial()
{
int number,factorial,temp=1;
printf("Enter the Number:");
scanf("%d", &number);
while(number>0)
{
temp=temp*number;
--number;
}
factorial=temp;
printf("\nThe factorial of number is:%d",factorial);
}
int main()
{
factorial();
return 0;
}"
help. turbo c program!! ASAP!? i have this program with me that will (supposedly) convert a rational number to a factorial. here is the code:
#include
int quo,prod;
float point;
int multiply(int quotient){
int i=0,k=0;
k=fact2(quotient);
do{
prod=k*i;
i++;
}while(prod<=quotient);
prod=prod-(k);
i=i-2;
return(i);
}
int fact2(int quotient) {
int f = 1,i=0;
do {
i++;
f=f*i;
}while(f<=quotient);
f=f/(i--);
return(f);
}
int factorial(int quotient) {
int f = 1,i=0;
do {
i++;
f=f*i;
}while(f<=quotient);
i--;
return(i);
}
main() {
int a,b,f;
double ans,anss;
clrscr();
printf("Input rational: ");
scanf("%d/%d",&a,&b);
ans=(float)a/b;
printf("%d/%d = %f\n",a,b,ans);
if(ans>0)
printf("\n[0,[");
else{
printf("\n[1,[");
anss=ans*-2;
ans=ans+anss;
}
quo=ans;
point=ans-(quo+0.0);
loop(quo);
getch();
loop2(point);
getche();
}
int loop() {
int fact,mul;
while(fact>=1){
fact=factorial(quo);
mul=multiply(quo);
printf("%d,",mul);
quo=quo-prod; }
printf("],["); }
loop2(float point) {
float facto,mul2;
while(point!=0){
facto=factorial2(point);
mul2=multiply2(point);
printf("%d,",mul2);
point=point-prod; }
}
int multiply2(float point){
int i=0,k=0;
k=facto2(point);
do{
prod=k*i;
i++;
}while(prod<=point);
prod=prod-(k);
i=i-2;
return(i); }
int facto2(float point) {
int f = 1,i=0;
do {
i++;
f=f*i;
}while(f<=point);
f=f/(i--);
return(f); }
int factorial2(float poinnt) {
int f = 1,i=0;
do {
i++;
f=f*i;
}while(f<=point);
i--;
return(i); }
the problem is that it passes a different value of point. why does this happen? i need help badly. i hope you could help me. thanks in advance.
gene_frequency replied: "int factorial2(float poinnt)
{
int f = 1,i=0;
do {
i++;
f=f*i;
}while(f<=point);
i--;
return(i); }
Right here, in factorial2(), the paramenter is "poinnt" -- which is never used in/by the function. The "point" used by the function is the global declared near the top of your code:
int quo,prod;
float point;
...bet that's why you're not getting expected results.
TIP1: if you turn up the warning level your compiler, then it should warn you about unused parameters like "poinnt", and it'll help you find these problems more rapidly/easily.
TIP2: this is why i always avoid use of globals whenever possible."
Turbo C problem (10 points)? Write a recursive function that will compute for the factorial of n.
10 points for you.....^_^
Why should I delete 10 points from my question?
Graham B replied: "Hi
Try this:
float fact(int n)
{
int f;
for ( f = n - 1 ; f > 1 ; f-- )
{
n *= f;
}
return n;
}
Hope it helps
G"
ritz replied: "remove 10 pts from ur ques"
andreea_oschanitzky replied: "#include
float f; /* global */
int n;
/*=========================================================================*/
void Factorial(void)
{
int i;
f = 1.0;
for (i=2; i<=n; i++) f *= i;
}
/*=========================================================================*/
void main()
{
printf("n = "); scanf("%i",&n);
Factorial();
printf("factorial = %g\n",f);
}
I don't remember the synthax as i should but it's the right ideea"
joby j replied: "Recursive fn:
int fact(int n)
{
if(n==1)
return 1;
else
return n*fact(n-1)
}
JJ"
turbo c code for program? can you please give me the code for a program that will compute the factorial value of n(as an input) and displays it. (use while loop, do while loop, and for loop)
the output should be like this:
enter a number: 5
the factorial value is: 120
optional:
can you please give me the code for a program that will do the fibonacci series (you can use any type of loop)
my code is not yet finished but it goes like this:
#incude
main()
{
int n;
printf("Input number");
input=getche();
printf("for loop example");
for(n=input;n>=n*n;n++)
that's all that i have finished but there are still errors and i need to use the 3 kinds of loop
tbshmkr replied: "Show your code.
=
We will help."
el e-phant replied: "uint fac = 0;
cin>>fac;
uint prod = 1;
uint i = fac;
while (i--){
prod = i * prod;
}
cout<
Turbo C program.. question? The factorial of N, where N is an integer, is define to be
1 if N is 0, and
1*2*3*4*5*.....*N if N is positive
MAKE A PROGRAM THAT WOULD INPUT N, ENSURE THAT IT IS NON-NEGATIVE,AND OUTPUT SEQUENCE/SERIES AND ITS EQUIVALENT FACTORIAL.
(PLEASE LEAVE AN EXPLANATION TO THE ANSWER TY.)
The output will be look like this..
enter a num. 7
1*2*3*4*5*6*7
The factorial is 5040
But if you enter 0 or 8+.. it will give an eror message because 0 and 8+ is out of range..
like this
enter 0
This is OUT of RANGE..
enter 8
This is OUT of RANGE..
Anand N replied: "include
#include
int main(){
int N;
int fact = 1;
int i = 0;
printf("Enter N");
scanf("%d",&N);
if(N>=0){
for(i=1;i<=N;i++)
fact = fact* i;
printf("Factorial is %d",fact);
}
else
printf(" N cannot be Negative ");
getch();
return ;
}"
tbshmkr replied: "Show us your code.
=
We will try to help."
help me in TURBO C? here is my program? but there are errors,
#include
#include
#define p printf
#define s scanf
void factorial(int ham)
{
int num;
clrscr();
p("NON RECURSIVE\n\n");
p("Enter number: ");
s("%d",num);
p("the factorial value is: %d");
s("%d",ham);
getch();
{
int t,n;
int ans=1;
for(t=1;t<=n;t++)
ans=ans*(t);
}
}
i cant use iostream..
koppe74 replied: "You must use the address-of operator (&) in your scanf-arguments. You can only omit it when the arguments are already pointers -- actual pointers (e.g. int *) or arrays (e.g. char string[50]) -- which are addresses by default (the variable-name, return it's address). Otherwise (like for int) you must obtain the address with the &-operator.
E.g.: s("%d",&num);
Why do you use ham as an argument to the function, when the user must input it through scanf (line before getch)? (You'll also need the &-operator here)."
Marc replied: "So you are making a program to compute for the factorial of a number right? Here's my program which is much simpler.
#include
#include
void main()
{
int num;
clrscr();
cout<<"\nEnter the number: ";cin>>num;
int t=1;
for(int i=num;i>0;i--)
{
t = t * i;
}
cout<<"\n The factorial is: "<

More Websites
Find More
turbo c factorial,
jordan orscheln,
wt 9001,
severance.barthilas.com,
soupful,
flybuys travel insurance,
ty42p50t,
bacharach h 10g,
santa express nene valley,
norse gael,
2lifelinden.com
Turbo C Factorial © 2009