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.
3 replies to this topic
#1
Posted 14 February 2012 - 08:06 PM
|
|
|
#2
Posted 15 February 2012 - 01:44 AM
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:
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.
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
Posted 15 February 2012 - 06:51 AM
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
Posted 16 February 2012 - 04:10 PM
Alex wants to be an expert in Garett's expence...
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









