1 like 0 dislike
12.2k views
Show more...
[Exercise] Coding (C) - asked in Chapter 4: Expressions by (12.1k points)
ID: 26465 - Available when: Unlimited - Due to: Unlimited

edited by | 12.2k views

91 Answers

0 like 0 dislike
Hidden content!
** * * **** *
int main()

{
** * **** ** *** * * meters, cost;
* * * ** * ** ** *** * * * **** *** ** ** * &meters);
* * ** ** * ** ***
* **** * * *** ** ***** ****** ** * <= 30)
** * *** * ** * * *** * *** * * * * * ** = 0.6*meters;
*** ** * ** * * ** if(meters <=50)
***** * * ** * ** * ***** ** * * * *** **** = 0.6*30 + 0.8* (meters -30);
* ** ** * ** *** ** if(meters <= 60)
* * ** * ** ** ** *** * * ** * *** ***** = 0.6*30 + 0.8*20 +1*(meters-50);
** **** * *** **** *
* ** ** * * * * ******* * * ** *** * ** * ** * = *** ** * ** ;
* * ** *** * **** ** *
******** * * * **** * += 10;
* * *** * * * * *** ** %.2f\n", cost);
** * * * * ** * * * * *
* * ** * * **** * ** * 0;
}
answered by (-233 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Wrong output
0 like 0 dislike
Hidden content!
* * * **** * **
int main()

{
* ** ** * **** * ** ** * * meters, cost;
** ** ** ** * * * * ** ** **** * ***** &meters);
**** * * ** * * *
* ** **** ** *** *** ** * <= 30)
**** * *** ** *** * ** * * * *** ** * = 0.6*meters;
*** * * * * * * *** if(meters <=50)
** ** *** ** ** ** * *** **** * ***** * * *** = 0.6*30 + 0.8* (meters -30);
*** * * * * ** * ** ** if(meters <= 60)
* * * ***** * * *** ** * *** ** * * **** * * = 0.6*30 + 0.8*20 +1*(meters-50);
* *** * **** ** ***** ***
* ** ** *** * ** *** * * ** * *** * *** ***** * = ** * ** *** * * ;
* * * **** * * *
* ** * * * * ** ** **** += 10;
* * * * ** ** ** * ** ** ** * ** %.2f\n", cost);
* * * * ** *** * *
*** * * ** *** * * * 0;
}
answered by (-233 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Wrong output
0 like 0 dislike
Hidden content!
#include <stdio.h>
int main()
{
    int a,b;
* * ** * ** *** * * * total;
* ** *** **** * **** *** **** * ***
** * ** ** * ** ***** ***** * ** ** * *** *** * ***
***** *** * *** * * * * *** ** * * * * * * * *** ** *** * *
* ***** * * * * * * * ** * ***** * * * ** ** ** * *** * *
**** * ** * ** * * * ** * * **
***** ** *** * ***** * ** ** * ** * * **
* * * *** *** ** * * * ** ** * %.2f",total);
** ***** * ** * * 0;
}
answered by (-32 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
0 like 0 dislike
Hidden content!
#include **** ** **
int main (){
int a,b,c;
float * ** ** **
* * ** * * * * number");
** ** * * * * ** *
total1=10+a*0.6;
* ** *** * ** ** * *** *
*** * *** ** *** * *** *
* * ***** * *** ***** ** *
*** ** *
*** *** * * * ** * * * * *
*** * * ** **** *
** * ** * *** *
* *** **
*** * * ** ******

return 0;
}
answered by (16 points)
0 0
prog.c: In function 'main':
prog.c:6:10: warning: format '%ld' expects argument of type 'long int *', but argument 2 has type 'int *' [-Wformat=]
 scanf("%ld",&a);
          ^
prog.c:10:10: warning: format '%ld' expects argument of type 'long int *', but argument 2 has type 'int *' [-Wformat=]
 scanf("%ld",&b);
          ^
prog.c:14:10: warning: format '%ld' expects argument of type 'long int *', but argument 2 has type 'int *' [-Wformat=]
 scanf("%ld",&c);
          ^
0 like 0 dislike
Hidden content!
#include<stdio.h>
int main()
{
int b=10;
float a,c;
    scanf("%f",&a);
*** ** * * * * ** * ******* * **** ********** *
* *** **** *** ** * * **** ** *** *** * * **** ** *** ** ** *** * **
* ** **** ** ** *** **** ** * ***** * *** * ** if(a>50)
*** * ** ***** * * * * *** * * *** *** * * ****** * *
*** *** *** * *** ***** * * ** * * * * ** *** if(a>30)
****** * **** * ** * * * **** * * * ** ****** * **** * *
*** *** *** * * * *** * * * * * **** ** ** if(a<=30)
******* * * ***** *** ** * * * * ****** ****** *
** * ** **** * **** * * * **** *** ** * * * *** * * *** *
* * * * ** *** *** * ** * *** ***** ** * * ** * 0;
}
answered by (64 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Wrong output
0 like 0 dislike
Hidden content!
#include * * * * * *
int main()
{
*** ** *** * **** **** a ,b,c,d,e,f,t;
* *** * ** ** * ** ** * * ***** ** * * *
* ** ***** ** ** ****** **
** *** * * * *** * ** **** **** **** ** * * ** * * + 30*0.6 + 20*0.8 + 10*1 + (a-60)*1.2 ;

* * ** * *** *** *** * *** * **** *
* ** ** ****** ** * ** ** * **** * ** ** *** + 30*0.6 + 20*0.8 + (60-a)*1;

***** * * ** * ** * * * ** * ** * **
* ** ** ** * * * * * * ** *** + 30*0.6 + (a-30)*0.8;

** **** * **** ** * *** ******** * **
* * *********** * ** ** * * *** ** ** * *** ** * + a*0.6;


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

* * *** * *** * * * * * * 0;
}
answered by (-32 points)
edited by
0 0
prog.c:2:2: warning: return type defaults to 'int' [-Wimplicit-int]
  main()
  ^~~~
0 0
prog.c:2:2: warning: return type defaults to 'int' [-Wimplicit-int]
  main()
  ^~~~
0 0
prog.c:2:2: warning: return type defaults to 'int' [-Wimplicit-int]
  main()
  ^~~~
0 0
prog.c:2:2: warning: return type defaults to 'int' [-Wimplicit-int]
  main()
  ^~~~
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Wrong output
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
0 like 0 dislike
Hidden content!
#include<stdio.h>
int main()
{
* ** ** * ** a,TOTAL=0;
**** ** * * * ***** * * ** ****** * * **
** *** ** **** * * ** * ** (a<=30)
* * ** *** ** * * **
* * * *** * * ** * **** * * *** * * *
** * * ********* ** * * * * * *** ** * * ** ** * *** %.2f",TOTAL);
**** ** *** * **** **** * *
** * * **** * ** * if (a>30 && a<=50)
* ** * * **** ** * *** *
** ** ** ******* ** * **** * * * ********** *** * *
* * **** ** ***** * * * * **** * ** * *** * * *** * * %.2f",TOTAL);
* ** ** ** * ** *** *
* * * * ** * * *** if (a>50 && a<=60)
* ** * * * *** ** *** ****
* * **** ** * ** * * * ***** ** ** * * *** * ** ** * * *** * *** * *
* * * ** * * ***** *** ** * * * * ** *** ** ** ** * %.2f",TOTAL);
********* * ** *****
**** ** ** ** * ** * * * if (a>60)
** ******** ** *** *
*********** *** * ** ****** * ** * **** *** ** * * * * * * * *
* * * ***** * ** **** * * * * * ** * * ** * *** %.2f",TOTAL);
    }
}
answered by (-214 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int meter;
    float cost;

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

* *** ********* ****** * *** ** *
*** *** * ** *** * * * * * * * ** * ** ** *
** * ****** *** * ** * * * * ***** * ** ** * * * * *** ** %.2f",cost);}
    else
** * * ******** ** * * ** * * ** ***** * ** * **
* * ****** * ** ** ** ** ** ** *** * ** * ***** *** **** * * * ****
* * * *** * ** ** * ***** * * *** ** ** ** ** * ** *** ** ******* * ** ** ** ** * %.2f",cost);}
* ** * * * ** * *** ** ** * **** * ** * * * *
* ***** * ** * * * *** ** ** * * *** ** * * * ** * * ** * * ** * ** ***
* ** * * * *** ** ***** ** * * ** * *** **** * *** ** ** * *** * * * * * * * *** ** * **** *** * * *** ***
* ** * **** ** *** ** * **** * * ** * * ** **** * *** ** * *** * * ** ** ** * ** * * ***** * ** %.2f",cost);}
** ***** * ** **** * * * ** ** * * ** ******* ****** ** ** ** * ** *
** * * ** ******** * * ** ***** ** * *** * * ** * * * *** * * ** * ** ** * ** * * * * *
** * ** * * ** * ** **** * * * * ** * * **** * * ** ***** ********* *** ***** ** ***** *** * ** **** * %.2f",cost);}

    return 0;
}
answered by (-16 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
0 like 0 dislike
Hidden content!
#include<stdio.h>
int main()
{
** * * * * * ** *** ** * a,b,c;
* *** ** * ** ** **** *** * ***** ** * *
** **** * * * * * * *
** **** * ******* ***
* * * * * ** ****** * * *** **
** * * * ** * * **
* * * * ** ** * ** **** if(a<50)
* * * * *** * * *
* *** ******* * ** * * * ** **** * * ***** * * * ** * ****** *
    }
* *** * * * * *** **** if(a<60)
    {
******* **** * * * * * ** ** ****** * * * ** * ***
    }
** * ** * ** * ****** * *
**** **** ** **** ** ** *
** * * *** * * *** ***** ** * * * ** * ** * ******
* * * * **** *** *
** * * *** * *** ** ** * * * * %.2f",c);
}
answered by (-329 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <stdlib.h>

int main()
{
**** ** * *** * a;
* ** * * **** **** * ** ******* *** ***** *
** *** * ** ** * ***** * ** ***** * ** ****
***** * *** ** *** *** * ** ** *** ** * ** %.2f",10+0.6*a);
** * ** * * **** *** * ** * ***** * * **** ** ** * **
* *** ** * *** * * ** ** ** * ******* * * ** %.2f",28+(a-30)*0.8);
* * * ** * * *** * * ** * * * **** * *** ** *
* * *** * ** * * * ** * * * *** * * * * ** ** *** * * %.2f",44+(a-50));
** * **** * *** ** ** *
** * * * * * ****** * * **** * ** ** ** * *** * ******** *** *** %.2f",54+(a-60)*1.2);
* * * *** ****** * * 0;
}
answered by (-498 points)
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.70.130.235
©2016-2025

Related questions

3 like 0 dislike
87 answers
[Exercise] Coding (C) - asked Oct 12, 2017 in Chapter 3: Formatted Input/Output by thopd (12.1k points)
ID: 26463 - Available when: Unlimited - Due to: Unlimited
| 9.8k views
3 like 0 dislike
86 answers
[Exercise] Coding (C) - asked Oct 5, 2017 in Chapter 4: Expressions by thopd (12.1k points)
ID: 25730 - Available when: Unlimited - Due to: Unlimited
| 8.7k views
12,783 questions
183,442 answers
172,219 comments
4,824 users