Write a program to add the following
¼+2/4+3/4+5/3+6/3+...

(Like up to any 12 no.s)



Write a program to add the following ¼+2/4+3/4+5/3+6/3+... (Like up to any 12 no.s)..

Answer / nitin garg

#include <stdio.h>
#include <conio.h>

int main()
{
float i,j,m=3,n=4;
float sum=0,fact=1;


for(i=1;i<=15;i++)
{
for(j=i;j<=m;j++)
{
sum=sum+(j/n);
printf("%f/%f +",j,n);
}
i=i+3;
m=m+4;
n--;
}
printf("

Sum of the series %f",sum);
getch();
}

Is This Answer Correct ?    4 Yes 0 No

Post New Answer

More C Interview Questions

What will be result of the following program? void myalloc(char *x, int n) { x= (char *)malloc(n*sizeof(char)); memset(x,\0,n*sizeof(char)); } main() { char *g="String"; myalloc(g,20); strcpy(g,"Oldstring"); printf("The string is %s",g); } a) The string is : String b) Run time error/Core dump c) The string is : Oldstring d) Syntax error during compilation e) None of these

3 Answers   IBM,


What is pre-emptive data structure and explain it with example?

0 Answers  


how to build a exercise findig min number of e heap with list imlemented?

0 Answers  


what is the purpose of the code, and is there any problem with it. unsigned int v[10]; unsigned int i = 0; while (i < 10) v[i] = i++;

2 Answers   Google,


In C, What is the #line used for?

2 Answers  






What is a structure and why it is used?

0 Answers   Hexaware,


What do you mean by keywords in c?

0 Answers  


who did come first hen or agg

15 Answers   Infosys,


how to print electricity bill according to following charges first 100 units -1rs per unit for next 200 units-1.50 rs per unit without using conditions

0 Answers  


we called a function and passed something do it we have always passed the "values" of variables to the called function. such functions calles are called a) calls by reference b) calls by value c) calls by zero d) none of the above

0 Answers  


Write a C program to multiply tho numbers without using arithmetic operator (+, -, *, /).

1 Answers  


write a program using linked list in which each node consists of following information. Name[30] Branch Rollno Telephone no i) Write the program to add information of students in linked list

0 Answers   Persistent,


Categories