Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Write a program for the following series:
1*3*5-2*4*6+3*5*7-4*6*8+.................up to nterms

Answers were Sorted based on User's Feedback



Write a program for the following series: 1*3*5-2*4*6+3*5*7-4*6*8+.................up to nterms..

Answer / sanath

#include <iostream.h>

void main()
{
int nTerm;
int x=1,y=3,z=5,mul1,total=0;

cout<<"Enter the NTerm:";
cin>>nTerm;
for(int i=1;i<=nTerm;i++)
{
mul1 = ((x++)*(y++)*(z++));

if(i%2)
total = total + mul1;
else
total = total - mul1;

}
cout<<"RESULT:"<<total<<endl;
}

Is This Answer Correct ?    2 Yes 0 No

Write a program for the following series: 1*3*5-2*4*6+3*5*7-4*6*8+.................up to nterms..

Answer / sri k. hari

/* Author : Sri K. Hari
Description : program for series
1*3*5-2*4*6+3*5*7-4*6*8...........upto n terms
*/

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

void main()
{
int n,i,res,finres;
char opt ;
clrscr () ;
do
{
res = 0 ;
finres = 0 ;
printf ( " \n Enter the last number " ) ;
scanf("%d",&n);

for ( i = 1 ; i <= n ;i++ )
{
res = ( i * (i+2) * (i+4) ) ;

if ( (i%2) == 0 )
finres = finres - res ;
else
finres = finres + res ;
}
printf ( " \n the result is : %d ", finres) ;
printf ( "Do you want to continue (Y/N)" ) ;
scanf ( "%s",&opt) ;
}while ( (opt == 'y' ) || (opt == 'Y' ) ) ;
}

Is This Answer Correct ?    1 Yes 0 No

Write a program for the following series: 1*3*5-2*4*6+3*5*7-4*6*8+.................up to nterms..

Answer / anshu porwal

#include<stdio.h>
#include<conio.h>
void main()
{
int x=1,y=3,z=5,n,cal,add=0,add1=0,total,i;
clrscr();
printf(" Enter Any Number to calculate Series for n
terms :");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
cal=(x*y*z);
x++;
y++;
z++;
if(i%2==1)
{
add=add+cal;
}
if(i%2==0)
{
add1=add1+cal;
}
}
total=add-add1;
printf(" Total Of Series Is %d",total);
getch();
}

Is This Answer Correct ?    1 Yes 1 No

Write a program for the following series: 1*3*5-2*4*6+3*5*7-4*6*8+.................up to nterms..

Answer / guest

#include<iosteram.h>
#include<conio.h>
int seri(int)
{
int r,s;
r=s*m+var;
return r;
}
void main()
{
int a[20],b[20];
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>a[i];
int var=-1;
m=a[i];
cout<<m;
getch();
}

Is This Answer Correct ?    1 Yes 1 No

Write a program for the following series: 1*3*5-2*4*6+3*5*7-4*6*8+.................up to nterms..

Answer / y hussain reddy

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

void main()
{
int i,p,n;
long s=0;
puts("nter n\n");
scanf("%d",&n);
for(i=1;i<=n;i++)
{p=pow(-1,i-1);
s+=i*(i+2)*(i+4)*p;
}
printf("ans=%ld",s);
}

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

write a program to generate address labels using structures?

0 Answers   SJC,


What do you mean by c what are the main characteristics of c language?

0 Answers  


write a program to display numbers from 1 to 10 and 10 to 1?

2 Answers  


write a program to print the all 4digits numbers & whose squares must me even numbers?

2 Answers   Virtusa,


Can you apply link and association interchangeably?

0 Answers   InterGraph,


10. Study the code: void show() main() { show(); } void show (char *s) { printf("%sn",s); } What will happen if it is compiled & run on an ANSI C Compiler? A)It will compile & nothing will be printed when it is executed B)it will compile but not link C)the compiler will generate an error D)the compiler will generate a warning

5 Answers   Accenture,


hat is a pointer?

4 Answers   Assurgent,


#include<string.h> void main() { String s1[]={"swathi"}; string s2[]={"maddimsetti"}; s1[]=s[]; printf("%s",s1[]); }

3 Answers   IBM,


What is the difference between %d and %i?

0 Answers  


Explain the difference between null pointer and void pointer.

0 Answers   TCS,


how does the C compiler interpret the following two statements p=p+x; q=q+y; a.p=p+x; q=q+y b.p=p+xq=q+y c.p=p+xq; q=q+y d.p=p+x/q=q+y

4 Answers   TCS,


What is the difference between single charater constant and string constant?

0 Answers  


Categories