简单程序...... [英] Simple Program...
问题描述
嗯,这是我的问题。
创建一个接受10个正整数的程序。该程序将对所有偶数和奇数进行分组和排序。偶数将按升序排序,而奇数将按降序排序。如果找不到偶数,则程序将打印无偶数。然而它打印奇数,反之亦然。
仅使用if语句或循环。(turbo c)(无数组或gotoxy()]
请帮帮我.....
样本输出1:
输入10个整数:1 2 3 4 5 6 7 8 9 10
显示:
偶数:
+ ----------------- --------- +
| 2 4 6 8 10 |
+ ---------------- ---------- +
奇数:
+ ------------------- -------- +
| 1 3 5 7 9 |
+ ----------------- ---------- +
排序偶数:
+ ------------------ --------- +
| 2 4 6 8 10 |
+ ---------------- ----------- +
排序奇数:
+ ----------------- ---------- +
| 9 7 5 3 1 |
+ --------------- ------------ +
样本输出2:
ENTER TEN INTEGERS:2 4 6 8 10 24 12 26 56 90
显示:
NO ODD NUMBERS!
偶数:2 4 6 8 10 24 12 26 56 90
SORTED EVEN:2 4 6 8 10 12 24 26 56 90
谢谢更多POwer!
>
您有任何代码吗?
如果有请发布。
问候,
M.Sivadhas 。
展开 | 选择 | Wrap | 行号
什么是确切的问题.....
Hey guys, can you help me with this? C programming major in Turbo c. LOL
Well, this is my problem.
Create a program that accepts 10 positive integers. The program will group and sort all even and odd numbers. Even numbers will be sorted in ascending while odd numbers will be sorted in descending order. If theres is no even numbers found the program will print "NO even numbers" yet it prints the odd numbers, and sort it vice versa.
Use if statements or loops only.(turbo c)(no arrays or gotoxy() ]
please do help me.....
SAMPLE OUTPUT 1:
Enter 10 integers: 1 2 3 4 5 6 7 8 9 10
DISPLAYS:
even numbers:
+--------------------------+
| 2 4 6 8 10 |
+--------------------------+
odd numbers:
+---------------------------+
| 1 3 5 7 9 |
+---------------------------+
sorted even numbers:
+---------------------------+
| 2 4 6 8 10 |
+---------------------------+
sorted odd numbers:
+---------------------------+
| 9 7 5 3 1 |
+---------------------------+
SAMPLE OUTPUT 2:
ENTER TEN INTEGERS: 2 4 6 8 10 24 12 26 56 90
DISPLAYS:
NO ODD NUMBERS!
EVEN NUMBERS: 2 4 6 8 10 24 12 26 56 90
SORTED EVEN: 2 4 6 8 10 12 24 26 56 90
Thanks MORE POwer!解决方案Hi,
Do u have any code?
If have please post it.
Regards,
M.Sivadhas.
Expand|Select|Wrap|Line Numbers
And what is the exact problem.....
这篇关于简单程序......的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文