CHALLENGE 3.8.1: If-else statement: Fix errors. ACTIVITY Re-type the code and fix any errors. The code should convert non-positive numbers to 1. if (userNum > 0) printf("Positive.\n"); else printf("Non-positive, converting to 1.\n"); userNum = 1; printf("Final: %d\n", userNum); Learn how our autograder works 1 #include 3 int main(void) { int userfum; 5 6 scanf("%d", &userNum); if(userNum>0) printf("postive.\n"); 10 11 printf("Non-positive, converting to 1.\n"); 12 13 14 7 8 15} 16 17 18) else( userNum-1; } printf("final:%d\n", userfum); return 0; Run Failed to compile main.c:17:4: error: expected identifier or before 'return' 17 1 return 0; I main.c:18:1: error: expected identifier or (before ''token 18 ) Mete Although

Systems Architecture
7th Edition
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Stephen D. Burd
Chapter3: Data Representation
Section: Chapter Questions
Problem 3RP
icon
Related questions
icon
Concept explainers
Question
100%

Need help with this, It's C Programming.

zy Section 3.8 - CIS 161: Introduction X Cc programming | Chegg.com
A
C
zy zyBooks - Build Co...V Vimm's Lair: Preser...
77°F
Windy
✰ learn.zybooks.com/zybook/AVCCIS161McCarySummer2023/chapter/3/section/8
Dashboard
= zyBooks My library > CIS 161: Introduction to C Programming home > 3.8: Common branching errors
CHALLENGE
ACTIVITY
else
Imported From Fire...
+
Re-type the code and fix any errors. The code should convert non-positive numbers to 1.
if (userNum > 0)
printf("Positive.\n");
3.8.1: If-else statement: Fix errors.
printf("Non-positive, converting to 1.\n");
userNum = 1;
printf("Final: %d\n", userNum);
Learn how our autograder works
480676.1279990.qx3zqy7
1 #include <stdio.h>
8
3 int main(void) {
4
int userNum;
5
6
Run
scanf("%d", &userNum);
if(userNum>0)
printf("postive.\n");
10
11 printf("Non-positive, converting to 1.\n");
12
13
14
15}
16
17
18 }
else{
userNum=1;
printf("final:%d\n", userNum);
return 0;
Failed to compile
main.c:17:4: error: expected identifier or '(before 'return'
17 I
return 0;
1
main.c:18:1: error: expected identifier or '('before '}' token
18 }
I
Note: Although the reported line number is in the uneditable part of the code, the error actually exists in your code. Tools often
Q Search
W
O
DID
1 test
passed
All tests
passed
EzyBooks catalog
? Help/FAQ
• VPN
Larry Williams
X
=
3:30 PM
6/1/2023
Transcribed Image Text:zy Section 3.8 - CIS 161: Introduction X Cc programming | Chegg.com A C zy zyBooks - Build Co...V Vimm's Lair: Preser... 77°F Windy ✰ learn.zybooks.com/zybook/AVCCIS161McCarySummer2023/chapter/3/section/8 Dashboard = zyBooks My library > CIS 161: Introduction to C Programming home > 3.8: Common branching errors CHALLENGE ACTIVITY else Imported From Fire... + Re-type the code and fix any errors. The code should convert non-positive numbers to 1. if (userNum > 0) printf("Positive.\n"); 3.8.1: If-else statement: Fix errors. printf("Non-positive, converting to 1.\n"); userNum = 1; printf("Final: %d\n", userNum); Learn how our autograder works 480676.1279990.qx3zqy7 1 #include <stdio.h> 8 3 int main(void) { 4 int userNum; 5 6 Run scanf("%d", &userNum); if(userNum>0) printf("postive.\n"); 10 11 printf("Non-positive, converting to 1.\n"); 12 13 14 15} 16 17 18 } else{ userNum=1; printf("final:%d\n", userNum); return 0; Failed to compile main.c:17:4: error: expected identifier or '(before 'return' 17 I return 0; 1 main.c:18:1: error: expected identifier or '('before '}' token 18 } I Note: Although the reported line number is in the uneditable part of the code, the error actually exists in your code. Tools often Q Search W O DID 1 test passed All tests passed EzyBooks catalog ? Help/FAQ • VPN Larry Williams X = 3:30 PM 6/1/2023
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Operators
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
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning