Answer to Question #215988 in C for Hemambar

Question #215988
Write a C program to solve the given series using recursion
1+(2^x/2)+(4^x/4)+(8^x/8)+...
1
Expert's answer
2021-07-15T00:10:24-0400


#include <stdio.h>


int get_sum(int n,int x){
    float sum=0;
    for(int i=1;i<=n;i++){
        if(i%2==0){
            sum=sum+(i^(x/i));
        }
    }
    return sum;
}
int main()
{
    float sum=get_sum(8,1);
    printf("%f",sum);


    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS