Jump to content

help. Cprogram

- - - - -

  • Please log in to reply
3 replies to this topic

#1
Garrettx

Garrettx

    Newbie

  • Members
  • PipPip
  • 11 posts
am seeking some help with these two program -- very urgent..

5. Write a c-program which will accept eight (8) odd numbers which are between ten (10) and forty (40) and store them in an array called my_odd_number, after which you should display the contents of the array starting with the last value which was placed in the array (reverse order).

4. Write a c-program which will accept both positive and negative integers from the user until 999 is entered to stop the program. Sum up both sets of numbers separately and determine the smallest and largest number from both set, display these results.

#2
alex1

alex1

    Learning Programmer

  • Members
  • PipPipPip
  • 93 posts
1.Create an array:
2. Insert the numbers into the array,by placing an if statement,wich will check if the entered number is odd:

int main(){

int my_odd_number[8];

int num;

for(int i=0;i<8;i++){

    do{    

        printf("Insert a num");

        scanf("%d",&num);

              if(num % 2)

                  my_odd_number[i] = num;

              else

                  clrscr();

                  printf("Give an odd number");

       }while(num % 2);

}

system("pause");

}


Check the code before using it - I just awake and can't make my mind up - but it's like that.
The next program is just like that,but you just have to check the input number and to sort the numbers.

Hope it helps somehow and again check my code.

#3
lespauled

lespauled

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 231 posts
  • Programming Language:C, C++, C#, JavaScript, PL/SQL, Delphi/Object Pascal, Visual Basic .NET, Pascal, Transact-SQL, Bash
Alex, you shouldn't do other people's homework. They will never learn if you give them the answers. We normally give them either pseudo-code or tell them to post what they have already done and help them when they are stuck.

#4
Ruzzar

Ruzzar

    Newbie

  • Members
  • Pip
  • 5 posts
Alex wants to be an expert in Garett's expence...




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users