• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 256
  • Last Modified:

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
0
txiong
Asked:
txiong
1 Solution
 
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
 
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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now