This is the question im suppose to answer, I don't really even know where to start.......... ..
Write a program to compute the partial sum of harmonic series
1 + 1/2 + 1/3 + L + 1/n
and display the intermediate partial sums. Hint: Use a for loop.
User Profile
Collapse
-
need help writing program
-
I think the problems is because the values i out in for M and T do not register and are not being used because no matter what numbers i put in for them the answer is always the same. Is there something i have to do to tell the program that the values i enter are for T and M -
hey i broke it up even more but still dont get right answer, heres the new code do you see anything wrong with it......
#include <stdio.h>
#include <math.h>
#define pi 3.1415926
int main (void)
{
double r, T, M, L,a,b,c;
// Read input data
printf("T= ");
scanf("%lf", &T);
printf("\nM=");
scanf("%lf",...Leave a comment:
-
Ok I get a number now but whatever number i put in for T and M i only get the answer 0.0000. Is there some reason why th eprogram is not performing the calculation right.Leave a comment:
-
hey I worked all the problems out but I dont get an answer, do you know what I did wrong, here is my updated code:
#include <stdio.h>
#include <math.h>
#define pi 3.1415926
int main (void)
{
double r, T, M;
// Read input data
printf("T= ");
scanf("%lf", &T);
printf("\nM=");
scanf("%lf",...Leave a comment:
-
-
i think the problem is that in the z= statement i use T but T is an unknown. Is there a way to a T= statement if T is a number i want to input into the programLeave a comment:
-
-
#include <stdio.h>
#include <math.h>
#define pi 3.1415926
int main (void)
{
double r, T, M, z,a,b;
// Read input data
printf("\nr = ");
scanf("%1f", &r);
printf("T= ");
scanf("&1f", &T);
printf("M=");
scanf("%1f", &M);
//Perform calculation
...Leave a comment:
-
i got the pi to work but i did use z in my r = equation right after the 1/2 i dont know why it says i dont use it the b and a work fine thoughLeave a comment:
-
nevermind i fix taht but get new error...
Code:#include <stdio.h> #include <math.h> int main (void) { double r, T, M,pi, z,a,b; // Read input data printf("\nr = "); scanf("%1f", &r); printf("T= "); scanf("&1f", &T); printf("M="); scanf("%1f", &M);
Leave a comment:
-
yeah tahnks i got most of the problem worked out the only error i get now after th enew code....
#include <stdio.h>
#include <math.h>
int main (void)
{
double r, T, M,pi, z,a,b;
// Read input data
printf("\nr = ");
scanf("%1f", &r);
printf("T= ");
scanf("&1f", &T);
printf("M=");...Leave a comment:
-
these are the errors i get after i think i made all the corrections....
#include <stdio.h>
#include <math.h>
int main (void)
{
double r, T, M,pi;
// Read input data
printf("\nr = ");
scanf("%1f", &r);
printf("T= ");
scanf("&1f", &T);
printf("M=");
scanf("%1f",...Leave a comment:
-
I was kind of wondering how to put unknown variables into the program. I am given values for T and M and somehow im suppose to put them into the program to solve for r. Im not quite sure how to put the equations in the program. I am suppose to put in the values of T and M to solve for r. This is my main problem. Please Help....Leave a comment:
-
radius of a star help writing program, need corrections?
hey im suppose to write a program using pelles C for windows to calculate the radius of the star using the formulas:
r = 1/2T^2 *sqrt( L/pi*σ)
L= 3.36192 *10^(140 - 2M/5)
σ = 5.67051*10^ -8
you are given and suppose to input the values for T and M to solve for r, so far I have this but im stuck and I dont even know if this is right:
Code:#include <stdio.h>
No activity results to display
Show More
Leave a comment: