30,000, the following message is displayed Sorry, you do not qualify. Your salar
ID: 3754517 • Letter: 3
Question
30,000, the following message is displayed Sorry, you do not qualify. Your salary must be at least $30,000." 3. Translate the following problems into C if/if-else statements. e all variables have been declared and that age and height already have been assigned values.) The value of ticket is three dollars unless at least one of the following is true: the value of age is greater than 12 the value of height is greater than or equal to 48 a. b. In that case, ticket is set to five dollars Assume all variables have been declared, and that t, p, and v already have been assigned values.) If the result of t divided by the quantity p minus v is greater than 10, then r is set to 0; otherwise, r is set to three times its initial value.Explanation / Answer
Below is the solution for the ticket price set
#include <stdio.h>
int main(void) {
int age=10, height= 48, ticket=0; // declare a variable age ,height ticket and initialize the value
if(age>12 || height>=48) //check if the age is greater than 12 or height is greater than equal to 48 then set the ticket value to 3 doller
ticket=3;// ticket set to 3 doller
else if(age<12 || height<48) //check if the age is less than 12 or height is less than 48 then set the ticket value to 3 doller
ticket=5; // ticket set to 5 doller
printf("Ticket price is: $%d",ticket);
return 0;
}
Sample output:
Set the r value:
Code:
#include <stdio.h>
int main(void) {
int t=7, p=21, v=2;// declare and initialize variable t,p,v and initialize the value
int r=10;
if(t/p ==0 && p-v>10)// check if t divided by p and p- v is greater than 20
r=0; // r set to 0
else
r=r+r+r; // r set the three times to initial value
printf ("r value is %d",r); // print r values
return 0;
}
Sample output:
r value is 0
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.