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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain Basic concepts of C language?

1237


What is the difference between declaring a variable and defining a variable?

1347


Differentiate between ordinary variable and pointer in c.

1253


Explain what is wrong with this statement? Myname = ?robin?;

1641


What is a pointer on a pointer in c programming language?

1190


Can a variable be both const and volatile?

1191


hi send me sample aptitude papers of cts?

2221


What is the difference between call by value and call by reference in c?

1213


What is self-referential structure in c programming?

1282


What is the default value of local and global variables in c?

1100


Why do we need functions in c?

1082


can anyone please tell about the nested interrupts?

2184


On most computers additional memory that is accessed through an adapter of feature card along with a device driver program. a) user memory b) conventional memory c) expandedmemory d) area

1166


What is the difference between array and pointer?

1085


What are preprocessor directives in c?

1156