1.) a program that would generate each of the following series
of numbers on the screen
this must be the output
a 1 4 9 16 25 36 49 64 81 100
b 1 2 4 7 11 16 22 29 37 46
c 1 2 4 8 16 32 64 128 256 512
2.)The Series Numbers:
1, 1, 2, 3, 5, 8, 13, 21, ...
is known as fibonacci series. each number is the sum of the two preceding numbers. write a program that reads in an arbitary number between 1 and 30 then display the fibonacci series of the number.
3.)the factorial of a non-negative integer n is written as n! (pronounced as "n factorial") and is defined as follows:
n!=n*(n-1)*(n-2)*...*(for values of n greater than or equal to 1) and n!=1 (for n=0)
write a program that reads a non-negative integer and computes and prints the factorial.
4.) write a program that estimates the value of the mathematical constant e by using the formula:
e=1 +1/1 + 1/2! + 1/3! + ..... 1/n!
What is Turbo C program for this problems?
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
Reply:Homework? work out yourself. I hope you are not lazy since you took the pains to type out such a long question, spend some more time to type out the programs that do this work.
Reply:Answer 1(a)
int x;
int y;
y = 0;
for (x=0; y=100)
{
if (x%2==0)
{
y=y+x;
}
x++;
}
printf ("%d"; y);
bridal flowers
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment