0 喜歡 0 不喜歡
3.2k 瀏覽

A water supply company charges the water consumption, as follows:

a) Fixed amount of 10$.
b) For the first 30 cubic meters 0.6$/meter.
c) For the next 20 cubic meters 0.8$/meter.  
d) For the next 10 cubic meters 1$/meter.  
e) For every additional meter 1.2$/meter.   

Write a program that reads the water consumption in cubic meters and displays the bill.
寫一個輸入水的用量 輸出水費的程式

Example Input:

25

Output:

Cost: 25.00

Example Input 2:

44

Output:

Cost: 39.20

Example Input 3:
 

75

Output:

Cost: 72.00

 

[考試] 最新提問 分類:Midterm | 用戶: (12.1k 分)
ID: 36750 - 從幾時開始: 2017-11-15 14:10 - 到幾時結束: 無限制
| 3.2k 瀏覽

19 個回答

0 喜歡 0 不喜歡
內容已隱藏
***** **** * * **
int main (){
int a,b,c;
float * * *** * *
* ***** ****** first your **** ** *
** * * ** * ** *** *
****** **
* *** * * * * * * * *
* * ** **** * second your meters: *** **
**** ******* *****
* * ***** *
* *** * ** *** ****
**** ** * second your meters: * ****
**** ** * * ** **
* *** ** ****
* * * * * ** *** **

return 0;
最新回答 用戶: (16 分)
0 0
prog.c: In function 'main':
prog.c:18:1: error: expected declaration or statement at end of input
 return 0;
 ^~~~~~
0 喜歡 0 不喜歡
內容已隱藏
#include<stdio.h>

int main(){
    float a,b,c,d,t;
*** ** * ** ** * *** * **** * * * * * * *
* * * * * ** ** *** * * *
** * * * ** ** * * **** * ** * * **** ** ** *
* * ** *** * * * *** * * *** ***
** * * ** * *** * ** ** * ****** * * * ** * * ** **
**** *** * * **** **** *** * * ** * *
* * ***** ** ** * ** * ***** *** * * ** * *** * ** ******
** ** * *** * * * ** ** ** * * * *
** * * ** ****** *** * * ** * **** * * * **** *

*** * ** * ***** ****** * * * * %.2f",t);
}
最新回答 用戶: (-32 分)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
0 喜歡 0 不喜歡
內容已隱藏
#include<stdio.h>
int main()
{

* ** * ** * *** *** ** usage,cost,contant=10;

* ** ** *** * * *** **** * * * *** ***** *** *

* * * * ** * *** * (usage>0 && usage<=30){
*** ** *** *** ** ** * * * * * * **** **** ***** contant);
** * ** * ** *** * *** * ** *** ***** * * * ** * * %.2f",cost);
* ** * ***** **** *
* * * ** * * ** ** && usage<50){
* ***** **** ** * ** * * * * *** * * ** * * ** + (30*.6)+ contant;
*** * * ** * * * ** ** * * * * * ** * *** *** * ** ** ** * %.2f", cost);
* * ***** ***** ** *
** *** * **** **** **** ** *** ** * *** *
** ** * * * * *** * * ** * ***** ** *** ** * * *** ** * *** *
* * ** *** * ** * * ** *** *** * * ** * *** *** * ** * %.2f",cost);
*** * *** * *** *** *
* ******** **** * **** if(usage>60){
***** ** * * **** *** * ***** ** * * * ** ** *** ** ** ** *** ** **
** ** ** * * * *** * * ** * *** ** * * * ** *** %.2f",cost);
* ** * ** *** * ***
* * * ** * * *** *** 0;
}
最新回答 用戶: (-167 分)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
0 喜歡 0 不喜歡
內容已隱藏
#include <stdio.h>
#include <stdlib.h>

int main()
{
* * * * * * * * ** * wc;
*** * ***** ** *** *** ** * total=0;
* ** * ** **** *** ** * tab1;
* * ******* ** *** * *** tab2;
******** ** *** ** * * * nt;
***** * *** * *** * * ** nt1;

* ***** ***** * **** * * * *** * * * * * ***

*** *** * ** **** * ** * ** *
    {
* * ** * ** ** ** * * * * ** * *** * ** ** *** * * * **
    }

* ** ** ** ** * ** **** * * * * ** ****** *
    {
* * * ** ***** * * * * * * * * ** **** ** *
* * ** * ** *** * *** ** *** * * * * * ** **

* * ** ** **** * *** ** ** ** *** * ****** **** *** *
* ** ** ** * * ** ** * **** ** *
* ***** ** * * * **** ** * **** * ** ***** * ** ** * * * * * ****** ** * ***** **
* *** * ** ***** * * * * *** * *** ** * *
* * * * ******* ********* ** ** * * ** * ** *
* ****** ***** * * * * ** ** * *** * * *
****** **** *** * *** ** * ** * * * **** * ** ** ** * * *** * **** *** *
* ** * * *** * * * * * * * * ** *

* * **** * * * ** * * * *** * * ** * **
    }

* ****** * * **** * *** ***
    {
* ** **** * *** * * ** * * ** * ** ** ** *

* * * ** * *** * * * *** ***** * **** **** ***** ** * * ** ** **
    }

* *** * ** *** * * * ** * * %.2f",total);

return 0;
}
最新回答 用戶: (-193 分)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
0 喜歡 0 不喜歡
內容已隱藏
#include <stdio.h>
#include <stdlib.h>

int main()
{
* * ** *** * ** * * wc;
*** ** *** * *** *** * * * *** ** total=0;
****** *** *** * * * * * tab1;
* ** *** * tab2;
* *** ** * * * **** nt;
    int nt1;

* * * * * * * * * * ** ***** * ** *

*** ** ** *** * *** **** ***** *
    {
***** * * *** * *** ** *** ** *** * * ** **** * *
    }

* * * ** * * *** * * * ** ** *** * * * *
    {
*** * * ** *** * ***** ** ** *** ** *** ***** **
** ** *** *** * *** *** ** ** *** * **** ** * * *** * * *

* * * * * **** * ** * ** **** ** * * *** **** * * * * *
*** * * ** * * ** * * * *** *** * * * ** ****
* **** ** * * ************ * **** ** ** * *** *** *** * ***
* ** ** ** ** * ** * * * * ** *** * **
** ** *** *** * *** ** * * * * ** ** ***
*** * * * ** ** *** *** * ** ** ** *** **** * * **
** *** ** * * * * * *** * * * * * * ** * *** * **
* * * * ***** * * *** * * **** * *** ** ** * * ***

* * *** * ** * * **** * * *** **** * * ** **** ** *
    }

****** * ** *** * * * * *
    {
* ** * * * * * **** ** ** ** * * * *** *******

****** ***** ** * *** ** * ** ** *** *** * *** * ** * ******* * * * *** *
    }

*** * * ** ** *** * *** *** * * * * ** **

return 0;
}
最新回答 用戶: (-193 分)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Wrong output
0 喜歡 0 不喜歡
內容已隱藏
#include<stdio.h>
int main()
{
    int water;
    float cost;
*** * * * * * * * * amount;

**** *** *** * * * * ** ** * * ** *** ** **

* ** **** **** * **** * * ** * && water<30){
**** ********* ** * * * * * **** ** *** = (water * 0.6) + 10;
** * * * * * **** ** * * * **** ****** * ** *
* * * * ** * **** ** * ***** ****** ** * && water<50){
* ** * * * * *** ** * * * * ** * * ** *** ** *** **** ** *** * ****** **** * * *
* * ***** ** * *** *** *** * * * ** ** * * * **** * ** * ** * ***** * * * *
***** ******** ** ** *** * ** *** * **** ** ** ** && water<60){
** * *** ** ** * * * ** *** * * * * * * * * * * ** * * * ** *** * **** * *** * **
* *** * *** ***** * * ** * ** * ** ** * *** ** * *** * *** * * ******* ** **
**** * * ** * ** * * * ** * ***** ** ** *** *** ****** ****** ***
** ** **** ** **** ** * * ******** * * * * *******
* * ***** *** * * * ** *** *** **** *** *** ** *
    return 0;
}
最新回答 用戶: (-167 分)
0 0
prog.c: In function 'main':
prog.c:8:13: warning: format '%d' expects argument of type 'int *', but argument 2 has type 'int' [-Wformat=]
     scanf("%d",water);
             ^
0 喜歡 0 不喜歡
內容已隱藏
#include<stdio.h>
int main()
{
** * * * * * *** * * ** a,b;
* ** * * * * ******* *** ** *** * ** * * * **
** * ****** * ** ** ** *
    {
**** * * ** * ** * * *** * ** *** * ** *** ** ** * *
* * ** ** ** *
** ***** ** * * * ***** * ** ** *** **** * * ** ** *
** *** * * ** ** *
* * **** ** * * * ** *** ** *** *** *** **** ** **** *
** *** *** *** **** *
** *** ***** ***** * * * * * ***** * ** ** * *
*** * * ***** * *
* * ** * ** * ** **** ** ** ** * ** ****** * * * * ** *
    }
* ** * * **** * ** **** * if(a>=60)
* * ****** *** * * *** * *
** * * *** * * * * * ***** * ** * *** * **** * **** ** *
    }
* * * ** * *** ** * * * * * %.2f",b);
}
最新回答 用戶: (-255 分)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
0 喜歡 0 不喜歡
內容已隱藏
#include <stdio.h>
#include <stdlib.h>

int main()
{
* * ***** ***** * * a;
** * * ** * ** * * * ******* ** ** ** * *
* * * * **** ** ***** (a<=30)
* * ** ** ** ** * ** *** *** *** * ** * **** * * %.2f",10+a*0.6);
** * * ** * * *** ** ** if(a<=50)
*** * * * * *** ** ****** ****** * ** ****** ** ** * ** **** * * *** *
* * * ** ** ** * if(a<=60)
** ** ***** *** * ****** *** * * ***** * ** ****** ** * * ***** * *** * * * *
** * *** ******* **** if(a>60)
** * ** *** *** * **** ***** * * ** **** * * * ** ** * **** * ******* * * ** ** *** **
* * ** * *** ** * ***** 0;
}
最新回答 用戶: (42 分)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
0 喜歡 0 不喜歡
內容已隱藏
#include <stdio.h>
#include <stdlib.h>

int main()
{
* * ** * * ***** * ** a;
* * ** * * **** ** * ** ** * **** * *
** ** * **** ***** * ** (a<=30)
* **** * * * ** ** ** ***** * ***** **** ** *** %.2f",10+a*0.6);
* * * ***** * * * * * if(a<=50)
* **** ** * * * *** * *** * * * * * * * *** * * * ** * *** * *** *** *** * * *
* * * *** *** *** ** if(a<=60)
** * ** ***** ** * * ** * * ** * ** * * * * ** ** * * * **
* * * *** * * ** ** if(a>60)
*** * ** * * * *** ******* * * *** * * ** ** *** ** * * * * * ** ******** *** ** **
* ** * ** * *** * * *** 0;
}
最新回答 用戶: (-108 分)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
0 喜歡 0 不喜歡
內容已隱藏
#include<stdio.h>
int main(void)
{
* * * * **** ** ******* c,total;
* ** ** * ***** ** *** ** ***** * ****

* **** ** *** * ***** **
**** * * * * *
** * * *** ** ** * * * *** * * * * * * **
* * ** ** ***** *** ** *** * * *** * **** * %.2f",total);
** * ** ** ** ***

* *** * * **** * if(c>30 && c<=50)
** * * ******* ** *
* *** **** * ** ** * * * * * * * * **** * * **
** **** * ** * * * ** ** ** * ** ** *** %.2f",total);

* ** * * * ***
** *** ** * ** ** if(c>50 && c<=60)
***** ** ***
* ** ** **** * * *** * ** ***** *** **** ****** **** *
**** * **** * * * ** * * ** ** ***** ** * ** * %.2f",total);
* * *** * **** * *
**** ****** ** *** *
* * ** ** **** *
** ** * ** * * * *** ** * * *** ****** ****** **** * * **
* * *** * ** * ** * ** *** ** **** * * * ** * * %.2f",total);
** ** ** ** ***




}
最新回答 用戶: (-249 分)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.69.17.201
©2016-2025

相關問題

1 喜歡 1 不喜歡
59 回答
[考試] 最新提問 11月 15, 2017 分類:Midterm | 用戶: thopd (12.1k 分)
ID: 32351 - 從幾時開始: 2017-11-15 14:10 - 到幾時結束: 無限制
| 8k 瀏覽
0 喜歡 0 不喜歡
15 回答
[考試] 最新提問 12月 9, 2017 分類:Midterm | 用戶: thopd (12.1k 分)
ID: 36755 - 從幾時開始: 2017-11-15 14:10 - 到幾時結束: 無限制
| 3k 瀏覽
0 喜歡 3 不喜歡
58 回答
[考試] 最新提問 11月 15, 2017 分類:Midterm | 用戶: thopd (12.1k 分)
ID: 32710 - 從幾時開始: 2017-11-15 14:10 - 到幾時結束: 無限制
| 7.3k 瀏覽
0 喜歡 0 不喜歡
21 回答
[考試] 最新提問 12月 9, 2017 分類:Midterm | 用戶: thopd (12.1k 分)
ID: 36754 - 從幾時開始: 2017-11-15 14:10 - 到幾時結束: 無限制
| 3.4k 瀏覽
0 喜歡 0 不喜歡
22 回答
[考試] 最新提問 12月 9, 2017 分類:Midterm | 用戶: thopd (12.1k 分)
ID: 36753 - 從幾時開始: 2017-11-15 14:10 - 到幾時結束: 無限制
| 3.5k 瀏覽
12,783 問題
183,442 回答
172,219 留言
4,824 用戶