• C

Simple Program to enter number

Hello Everyone,

I am a student and have no clue about programming. I am tasked to do the following and need to see if someone can explain step-by-step how to write them.

1. Write a program to ask enter 5 numbers, then check which number is the biggest.

2. Write a shell script to print on the screen the odd numbers 1 3 5 7 9...99

I have no idea how to get myself started on this.

Thanks in advance
txiongAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mic77Commented:
Well Question 1 would be like this Programm.

#include <stdio.h>
int main()
{
      int i;
      int scan = 0;
        int oldval = 0;
      for(i=0; i < 5 ;++i){
            printf("Enter %d. Value:\n", i+1);
            scanf ("%d",&scan);
            if (oldval < scan){
                  oldval = scan;
            }
      }
      printf("Biggest Value = %d\n", oldval);
      return 0;
}

You could also store every Value in an Array if you need the Values later on.

I am not sure about Question 2:
Just use a loop. I do not know much about Shell Programming. The Syntax depends on the Shell you aare using

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
txiongAuthor Commented:
Mic77,

Thanks so much for the help. I have played around with the program and studied it. It is exactly what I was looking for and studying. This definitely will help me learn more about C programming. I really really appreciate your time.

Thanks a bunch!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.