Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as C by Now ( 15 years ago )
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <conio.h>

int cal01(int n, int m)
{
    int i, product, result = 0;
    product = n * m;
    for ( i = 1; i <= product; i++)
    {
        result += i;
    }
    return result;
}
int faction (int num)
{
    int result ,n;
    result = 1;
    for (n=1; n <= num; n++)
    {
        result *= n;
    }
    return result;
}
int cal02(int n, int m)
{
    int result, a,b;
    a = faction (n+1);
    b = faction (m-1);
    result = a + b;
    return result;
}

double cal03(int n, int m, int k)
{
    double result;
    result = pow(k, n-1) + pow(k, m+1);
    return result;
}

int main(void)
{
    int n, m, k;
    printf("Enter n, m: "); scanf("%d %d", &n, &m);
    printf("\n\nS(n,m) = %d", cal01(n,m));
    printf("\n\nP(n,m) = %d", cal02(n,m));
    printf("\n\nEnter k : "); scanf("%d", &k);
    printf("\nE(n,m,k) = %.0f", cal03(n,m,k));
    getch();
}

 

Revise this Paste

Your Name: Code Language: