Image

Imagedelusory wrote in Imagecprogramming 😡frustrated

Listens: Disturbed - Down With the Sickness

Hello. I am new here... and I am having difficulties getting my program working. It's extremely basic C and I am ashamed that I cannot figure it out by myself.

#include <stdio.h>
#include <math.h>

float sumsq(int);
float sumcb(int);
float frthrt(int);

int main() {
int num,count=0;
float sqroot;
printf("Number\t SumSq\t SumCb\tSqRoot\t4thRoot\n");
for (num=25;num<=99;num+=2) { /* generates the odd numbers between 25 and 99 */
printf("%6d",num);

printf("\t%6.0f",sumsq(num));

printf("\t%10.0f",sumcb(num));

sqroot=sqrt(num);
printf("\t%6.2f",sqroot);

printf("\t%7.2f\n",frthrt(num));

count++;
}
return 0;
}


/* following function finds sum of squares from 1 to the number */

float sumsq(int num) {
int number;
float sum=0;
for(number=1;number<=num;number++)
sum+=(number*number);
return sum;
}


/* following function finds sum of cubes of odd numbers from 1 to number */

float sumcb(int num) {
int number;
float sum=0;
for(number=1;number<=num;number+=2)
sum+=(number*number*number);
return sum;
}


/* following function finds fourth root of number */

float frthrt(int num) {
float frthroot;
frthroot=sqrt(sqrt(num));
return frthroot;
}

Output:
Image

*whines* What am I doing wrong?

Any help is appreciated :)