学年

教科

質問の種類

情報 大学生・専門学校生・社会人

c言語プログラム 本当に分かりません。 どなたか教えてください

(2点) 【演習3】 if-else と繰り返し文 最大値(整数)と整数xをキー入力すると、1から最大値までの整数を順に表示するプログラムを if-else 文および for文を使って作成せよ。 ただし、最大値が10~50以外の場合、または整数 x が 2~9以外で 入力された場合は、「範囲エラー」 を表示すること。 また、1から最大値までの整数を表示する際、表示 する整数が整数xで割り切れる場合は を、 割り切れない場合はその整数を表示すること。 xで割り切れる値は☆を表示 <ソースプログラム> #include <stdio.h> int main (void){ イント2 ント5 } printf("最大値: "); /* 変数宣言*/ return 0; printf(" 整数x: "); cats ; /*キー入力*/ // *キー入力*/ <実行例①> |最大値: 10 ↓ 整数x2↓ 13579☆ <実行例②> |最大値: 50 ↓ 整数x 91 12345678 10 11 12 13 14 15 16 17 19 | 20 21 22 23 24 25 26 28 29 30 31 32 33 34 35 ★ 37 38 39 40 41 42 43 44 46 47 48 49 50 <実行例③> 最大値: 9 整数x2↓ 範囲エラー <実行例⑤ > 最大値: 10 ↓ 整数X : 1↓ 範囲エラー <実行例④ > | 最大値: 51 ↓ 整数X ↓ 範囲エラー <実行例⑥ > 最大値: 50 ↓ 整数x : 10↓ 範囲エラー (下線部はキー入力を、↓は Enter を示す)

未解決 回答数: 1
TOEIC・英語 大学生・専門学校生・社会人

自分の回答と照らし合わせて確認したいので、答えがなにになるかどなたか教えてください。 解説もあると助かります。

5 A Matter of Taste Reading Passage 042 At the age of just 22, Jamie Oliver became well known across the UK as "The Naked Chef." He called himself this not because he cooked wearing no clothes, but because he wanted to simplify food preparation so that everybody could follow his recipes. He wanted to "strip down" the idea of cooking. Since then he has had numerous TV shows, published 50 many books, and has become a household name in the UK. Today, one of the activities Jamie Oliver is best known for is his great effort to improve the school dinners that children eat every day. One day, he visited the kitchen of a typical London secondary school, and he was shocked to see how much processed junk food the kids were given to eat each day. Fat and sugar levels were extremely high, and nutritional values very 10 low. The "turkey twizzler" became the symbol of these unhealthy meals: processed meat containing 21.2% fat and only 34% actual turkey. Oliver ran the school kitchen for one year and tried to show that it was possible to serve healthy meals on a limited budget—and that kids actually enjoyed eating them. His mission was to radically change the eating habits of children in that school, and across the country. 150 200 15 20 25 CULTIES 250 His project (the "Feed Me Better" campaign) has had some influence on school dinners in the UK. After watching the documentary Jamie's School Dinners, 271,677 people signed a petition calling for healthier school meals. This led the Prime Minister to agree to spend 280 million pounds (about 37 billion yen) on school dinners, to ban some junk food from school menus, and to create a School Food Trust to provide support and advice for people preparing school meals. Research, by the way, shows that children who stop eating sugary, fatty food and instead eat Oliver's school dinners are better behaved in class, and they get higher test 300 scores, too. 350 Of course, the project has had some problems. At first, many students (and even parents) resisted the removal of the junk food they were so used to. In one famous instance, some parents were passing local takeaway food to their children through the school fence. Also, schools that followed the plan for a while were often found to gradually drift back into bad habits. After all, it is easier and cheaper to just give the kids junk food. However, Oliver's efforts represent a positive start, and with obesity becoming such a huge problem (see Unit 4), 400 it's a very necessary start.

解決済み 回答数: 1