Friday, March 23, 2012

Algorithm (Lab report 04)

Theory:
The exponential differential equations which are the topic of this thesis will be defined in terms of invariant differential forms on commutative algebraic groups, in particular semiabelian varieties. The theory of the equations depends on a good understanding of the algebraic subgroups of commutative algebraic groups.

The main work of the thesis, establishing the theory of exponential   differential equations, Differential equations contains background material from differential algebra and algebraic geometry, and the final gives an application.

Apparatus:
        i.     Computer.
        ii.    Coding Language.
        iii.   Compiler (Code block, Dev c/c++, Turbo c/c++ etc.)
        iv.   Coding skill.
Algorithm: (Computational (Exponential) of  X^n)
Step 01: Exponential (X^n)
Step 02: m=n; pow=1; z=X;
Step 03: while(m>0) do
Step 04: while(m mod 2==0) do
Step 05:  {
Step 06       m=(m/2); z=z^2
Step 07:      m=m-1;
Step 08:     pow=pow*z;
Step 09:   }
Step 10: return pow;

Source code 01: (Exponential)
# include<stdio.h>
# include<math.h>
# include<conio.h>
int main()
{
int i,test;
float x,total=0;
scanf("%d",&test);
for(i=1;i<=test;i++)
{
  scanf("%f",&x);
  total+=pow(x,i);
}
printf("%.0f",total);
getch();
return 0;
}
Source code 02: (Exponential)
# include<stdio.h>
# include<math.h>
# include<conio.h>
int main()
{
int i,test;
float x,y,total=0;
scanf("%d",&test);
for(i=1;i<=test;i++)
  {
  scanf("%f%f",&x,&y);
  total+=pow(x,y);
}
printf("Total: %.0f",total);
getch();
return 0;
}


Result 01:
Sample Input                                           Sample output

3
10                                                                           Total: 27480
20
30


Result 02:
Sample Input                                           Sample output

3

10    1                                                                       Total: 27480
20    2
30    3

Caution: You must change this code. And also change the test value when you print it......Try to make change or modify this.

2 comments:

Comment of this content!