Responsive Ads Here

Wednesday, November 26, 2014

Series=40-38+36-........n

Series=40-38+36-........n

 

 

//Series=40-38+36-........n
 
#include<stdio.h>
int main(){
    int n,sum,increase,term;
    scanf("%d",&n);
    sum=0;
    increase=40;
    for(term=0;term<n;term++){
        if(term%2==0)
            sum+=increase;
        else
            sum-=increase;
        increase-=2;
    }
    printf("The summation of the series id %d\n",sum);
    return 0;
}

No comments:

Post a Comment

php4

<?php    // Start the session  session_start();  ?>  <!DOCTYPE html>  <html>  <head>       <link rel=&q...