Using C. An integer variable, total, is initialized to 10 in the code editor. Ask the user to input an integer and check if it is positive, negative, or zero. if positive: check if it is even or odd. if it is even, add its square to total, otherwise add its cube to total if negative: ask the user to input another integer as an exponent to this negative number and add the result to total. if zero: print "Nothing happened." Lastly, only print the value of total if the inputted integer is positive or negative.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter4: Selection Structures
Section4.3: Nested If Statements
Problem 3E
icon
Related questions
Question
Using C. An integer variable, total, is initialized to 10 in the code editor. Ask the user to input an integer and check if it is positive, negative, or zero. if positive: check if it is even or odd. if it is even, add its square to total, otherwise add its cube to total if negative: ask the user to input another integer as an exponent to this negative number and add the result to total. if zero: print "Nothing happened." Lastly, only print the value of total if the inputted integer is positive or negative.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 6 images

Blurred answer
Knowledge Booster
Constants and Variables
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
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,