Hello I need some C programming help I tried my best to figu

Hello, I need some C programming help. I tried my best to figure it out, but I am stuck. I think I am very close on all of them except for module5_exercise2. That one I am absolutely stuck. The others are just giving me a one or two errors that I cannot figure out, hopefully that means I am pretty close.

module5_exercise1: This one I am pretty close. The program runs, but then a window pops up saying \"Debug Error\"
module5_exercise2: I am completely stuck
module5_exercise3: This one I am close as well (I think). Window pops up but does not run properly
module5_exercise4: Confused, don\'t know where to go. I thought I did declare num and highNum, but it says I have not
module5_exercise5: Close as well

Solution

Okay so lets start, as we are allowed to answer only one question at a time, So to get answers to other questions please repost them separately.

So here we will be solving the first question...

Here in the first question first lets print all the even numbers from 1 to 100.

Then we can make a array and store the numbers in the array, and the array will be of size 50 from 1 to 50, now printing the last 5 elements of the array we get the largest 5 Even Numbers.

The Code is as given below

#include <stdio.h>

int main()
{
int i,b;
int a[50];
printf(\"All even numbers from 1 to 100 are: \ \");

for(i=1; i<=100; i++)
{
if(i%2==0)
{
printf(\"%d\ \", i);
}
}
    for(i=1; i<=100; i++)
    {
        if(i%2==0)
        {
            b=i/2;
            a[b]=i;
        }
    }
    printf(\"\ Top 5 Largest Even Numbers are:\ \ \");
    printf(\"Number:%d\\t\",a[50]);
    printf(\"Number:%d\\t\",a[49]);
    printf(\"Number:%d\\t\",a[48]);
    printf(\"Number:%d\\t\",a[47]);
    printf(\"Number:%d\\t\",a[46]);
return 0;
}

Thank You for using Chegg...

 Hello, I need some C programming help. I tried my best to figure it out, but I am stuck. I think I am very close on all of them except for module5_exercise2. T

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site