I need help with these, C Programming

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

I need help with these, C Programming.

zy Section 3.12 - CIS 161: Introduction X
Answered: Assign is Teenager with true
A
C
□
zy zyBooks - Build Co... V Vimm's Lair: Preser...
74°F
Windy
learn.zybooks.com/zybook/AVCCIS161McCarySummer2023/chapter/3/section/12
Dashboard
=zyBooks My library > CIS 161: Introduction to C Programming home > 3.12: Boolean data type
CHALLENGE 3.12.2: Bool in branching statements.
ACTIVITY
+
Imported From Fire...
Write an if-else statement to describe an integer. Print "Positive even number" if isEven and is Positive are both true. Print "Positive
number" if isEven is false and is Positive is true. Print "Not a positive number otherwise. End with newline.
Learn how our autograder works
480676.1279990.qx3zqy7
1 #include <stdio.h>
2 #include <stdbool.h>
6
7
8
9
10
11
12
13
3
4 int main(void) {
5
14
15
16}
Run
int userNum;
bool ispositive;
bool isEven;
scanf("%d", &userNum);
isPositive
(userNum > 0);
isEven = ((userNum % 2) == 0);
* Your solution goes here */
return 0;
8
How was this section? 13
Q Search
9¹
Provide section feedback
Feedback?
O
DOL
1 test
passed
All tests
passed
Feedback?
EzyBooks catalog
3.13 String comparisons
Help/FAQ
• VPN
Larry Williams
X
|||
4:30 PM
6/1/2023
Transcribed Image Text:zy Section 3.12 - CIS 161: Introduction X Answered: Assign is Teenager with true A C □ zy zyBooks - Build Co... V Vimm's Lair: Preser... 74°F Windy learn.zybooks.com/zybook/AVCCIS161McCarySummer2023/chapter/3/section/12 Dashboard =zyBooks My library > CIS 161: Introduction to C Programming home > 3.12: Boolean data type CHALLENGE 3.12.2: Bool in branching statements. ACTIVITY + Imported From Fire... Write an if-else statement to describe an integer. Print "Positive even number" if isEven and is Positive are both true. Print "Positive number" if isEven is false and is Positive is true. Print "Not a positive number otherwise. End with newline. Learn how our autograder works 480676.1279990.qx3zqy7 1 #include <stdio.h> 2 #include <stdbool.h> 6 7 8 9 10 11 12 13 3 4 int main(void) { 5 14 15 16} Run int userNum; bool ispositive; bool isEven; scanf("%d", &userNum); isPositive (userNum > 0); isEven = ((userNum % 2) == 0); * Your solution goes here */ return 0; 8 How was this section? 13 Q Search 9¹ Provide section feedback Feedback? O DOL 1 test passed All tests passed Feedback? EzyBooks catalog 3.13 String comparisons Help/FAQ • VPN Larry Williams X ||| 4:30 PM 6/1/2023
zy Section 3.12 - CIS 161: Introduction X
A
C
□
zy zyBooks - Build Co... V Vimm's Lair: Preser...
Answered: Assign is Teenager with true
✰ learn.zybooks.com/zybook/AVCCIS161McCarySummer2023/chapter/3/section/12
74°F
Windy
Dashboard
=zyBooks My library > CIS 161: Introduction to C Programming home > 3.12: Boolean data type
Imported From Fire...
CHALLENGE 3.12.1: Using bool.
ACTIVITY
+
Assign is Teenager with true if kidAge is 13 to 19 inclusive. Otherwise, assign is Teenager with false.
Learn how our autograder works
480676.1279990.qx3zqy7
10
11
12
13
4 int main(vola) {
5 bool isTeenager;
6
int kidAge;
7
8
9
Run
scanf("%d", &kidAge);
if (kidAge>13 && kidAge<19) {
isTeenager=true;
}
{else if
14
15
16
17
18}
19 else {
20
21 }
isTeenager=false;
if (isTeenager) {
printf("Teen");
printf("Not teen");
Failed to compile
main.c: In function 'main':
main.c:13:5: error: 'else' without a previous 'if'
13 |
{else if
main.c:14:7: error: expected '('before 'isTeenager'
isTeenager=false;
14 |
1
1
(
Q Search
O
Feedback?
DO
passed
All tests
passed
Feedback?
EzyBooks catalog
Help/FAQ
• VPN
Larry Williams
X
|||
4:30 PM
6/1/2023
Transcribed Image Text:zy Section 3.12 - CIS 161: Introduction X A C □ zy zyBooks - Build Co... V Vimm's Lair: Preser... Answered: Assign is Teenager with true ✰ learn.zybooks.com/zybook/AVCCIS161McCarySummer2023/chapter/3/section/12 74°F Windy Dashboard =zyBooks My library > CIS 161: Introduction to C Programming home > 3.12: Boolean data type Imported From Fire... CHALLENGE 3.12.1: Using bool. ACTIVITY + Assign is Teenager with true if kidAge is 13 to 19 inclusive. Otherwise, assign is Teenager with false. Learn how our autograder works 480676.1279990.qx3zqy7 10 11 12 13 4 int main(vola) { 5 bool isTeenager; 6 int kidAge; 7 8 9 Run scanf("%d", &kidAge); if (kidAge>13 && kidAge<19) { isTeenager=true; } {else if 14 15 16 17 18} 19 else { 20 21 } isTeenager=false; if (isTeenager) { printf("Teen"); printf("Not teen"); Failed to compile main.c: In function 'main': main.c:13:5: error: 'else' without a previous 'if' 13 | {else if main.c:14:7: error: expected '('before 'isTeenager' isTeenager=false; 14 | 1 1 ( Q Search O Feedback? DO passed All tests passed Feedback? EzyBooks catalog Help/FAQ • VPN Larry Williams X ||| 4:30 PM 6/1/2023
Expert Solution
steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Knowledge Booster
Introduction to computer system
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education