Simple Program to enter number

Posted on 2004-11-29
Last Modified: 2010-04-15
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
Question by:txiong

    Accepted Solution

    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


    Author Comment


    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!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
    Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
    The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.
    The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now