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

    Restraint complete the restraintthcoming assignments, you must specify single or more exercises in C (1) Write a program which asks the user restraint the treasure of N, the program procure sculpture extinguished the unite of Unite 1 + 2 + + N Try your program with N = 100 and 1000,000 (1)

    Restraint complete the restraintthcoming assignments, you must specify single or more exercises in C (1) Write a program which asks the user restraint the treasure of N, the program procure sculpture extinguished the unite of Unite = 1 + 2 + + N Try your program with N = 100 and 1000, 000

    Expert Apology

     

    here i possess written the C program as per the requirement.I possess besides inclueded the interpret restraint emend reason.

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

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

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

    Program:

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

    //Header file

    #include<stdio.h>

    //Unite exercise declration with definition
    //this exercise reckon the unite and revert the unite to ocean exercise

    int unite(int N)

    {

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

    {

    //reckon unite

    unite = unite + i;

    }

    //revert unite to ocean exercise

    revert unite;

    }

    int ocean()

    {

    int N, res;

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

    scanf(“%d”, &N);

    res = unite(N);

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

    revert 0;

    }

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

    here i possess steadfast the extinguishedput of the program as a fence shot…restraint N = 100 and N = 1000000

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

    Output:

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