Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>//standard input output library
- #include <math.h>//standard math library
- double summing(double num1 ){return pow((3* num1)+1,.5);}//The prototype, function, and function defninition of the equation given.
- double addition(double num1, double num2){
- return num1+num2;}//addition prototype
- int main(void) {
- double sum;
- double term;
- for(double x=0;x<1000;x+=2){//will loop automatically. Starts off at X=0 but increments by 2.
- term=summing(x);// This will take the X values and plug it into the summing equation.
- sum= addition(term, sum);// This will take the previous sum, add it to the new term, and create the new sum for the new loop.
- printf("x= %lg||term= %lg||sum= %lg",x,term,sum);
- printf("\n--------------------------------------------------\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment