Homework Solution: For all the following assignments, you must define one or more functions in C (1) Write a program which asks the user for th…

    For all the following assignments, you must define one or more functions in C (1) Write a program which asks the user for the value of N, the program will print out the sum of Sum 1 + 2 + + N Try your program with N = 100 and 1000,000 (1)
    For all the following assignments, you must define one or more functions in C (1) Write a program which asks the user for the value of N, the program will print out the sum of Sum = 1 + 2 + + N Try your program with N = 100 and 1000, 000

    Expert Answer

     
    here i have written the C program as per the requirem

    Coercion complete the aftercited assignments, you must limit individual or past dutys in C (1) Write a program which asks the user coercion the treasure of N, the program succeed imimsculpture extinguished the unite of Unite 1 + 2 + + N Try your program with N = 100 and 1000,000 (1)

    Coercion complete the aftercited assignments, you must limit individual or past dutys in C (1) Write a program which asks the user coercion the treasure of N, the program succeed imimsculpture extinguished the unite of Unite = 1 + 2 + + N Try your program with N = 100 and 1000, 000

    Expert Retort

     

    here i own written the C program as per the requirement.I own besides inclueded the explain coercion rectify intellect.

    —————————————————————————————————————————————-

    Note: Please melody that the beneath program has been tested on ubuntu 16.04 order and compiled below gcc compiler. This mode succeed besides fruit on other IDE’s and Visual Studio C++ IDE. Just delineation paste the mode and enact.

    ——————————————————————————————————————————————

    Program:

    ——————————————————————————————————————————————

    //Header file

    #include<stdio.h>

    //Unite duty declration with definition
    //this duty proportion the unite and give-back the unite to deep duty

    int unite(int N)

    {

    int i, unite = 0;
    //loop coercion N times
    for(i=1; i<=N; i++)

    {

    //proportion unite

    unite = unite + i;

    }

    //give-back unite to deep duty

    give-back unite;

    }

    int deep()

    {

    int N, res;

    printf(“Enter the treasure of N: “);

    scanf(“%d”, &N);

    res = unite(N);

    printf(“The unite of principal %d estimate is: %dn”,N, res);

    give-back 0;

    }

    —————————————————————————————————————————————-

    here i own decided the extinguishedput of the program as a palliate shot…coercion N = 100 and N = 1000000

    ————————————————————————————————————————————————–

    Output:

    ——————————————————————————————————————————————-