Homework Solution: Repeat problem (1) to print out the sum of (N must be an odd number) Sum…

    (2) Repeat problem (1) to print out the sum of (N must be an odd number) Sum = 1 + 32 + 52 + + N2 Try your program with N-39 2
    Repeat problem (1) to print out the sum of (N must be an odd number) Sum = 1 + 3^2 + 5^2 + + N^2 Try your program with N = 99

    Expert Answer

     
    The following program calculates the sum of those numbers which produces remainder after dividing by 2.

    (2) Repeat bearing (1) to imimprint extinguished the incorporate of (N must be an fragmentary reckon) Incorporate = 1 + 32 + 52 + + N2 Try your program with N-39 2

    Repeat bearing (1) to imimprint extinguished the incorporate of (N must be an fragmentary reckon) Incorporate = 1 + 3^2 + 5^2 + + N^2 Try your program with N = 99

    Expert Confutation

     

    The succeedingcited program calculates the incorporate of those reckons which produces remnant succeeding dividing by 2.

    So if my input N=5 i.e. incorporate of squares of 1,3,5,7,9

    Output = (1 + 9 + 25 + 49 + 81) = 165

    Here is the program

    #include<stdio.h>
    void main()
    {
    int NUM,i,j,SUM=0;
    printf(“nENTER INTERGER NUMBER : “);
    scanf(“%d”,&NUM);
    for(i=1;i<NUM+1;i++)
    {
    if(i%2!=0)
    {
    SUM=SUM+(i*i);
    }
    }
    printf(“nTHE SUM OF SQUARE OF ODD NOS. TILL %d NO. IS : %d”,NUM,SUM);
    }

    OUTPUT