1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
vovangra [49]
3 years ago
12

Programming CRe-type the code and fix any errors. The code should convert non-positive numbers to 1.

Computers and Technology
1 answer:
LUCKY_DIMON [66]3 years ago
5 0

Answer:

Given

The above lines of code

Required

Rearrange.

The code is re-arrange d as follows;.

#include<iostream>

int main()

{

int userNum;

scanf("%d", &userNum);

if (userNum > 0)

{

printf("Positive.\n");

}

else

{

printf("Non-positive, converting to 1.\n");

userNum = 1;

printf("Final: %d\n", userNum);

}

return 0;

}

When rearranging lines of codes. one has to be mindful of the programming language, the syntax of the language and control structures in the code;

One should take note of the variable declarations and usage

See attachment for .cpp file

Download cpp
You might be interested in
Assume that a file contains students' ids, full names, and their scores (Assignments grade, quizzes grade,
elixir [45]

Answer:

اope its heمحبعم

Explanation:

3 0
2 years ago
PLEASE HELP! WILL MARK AS BRAINLIEST JavaScript can be implemented using the _________ HTML tags in a web page.​
Keith_Richards [23]

Answer:

JavaScript can be implemented using JavaScript statements that are placed within the ...  HTML tag

Explanation:

8 0
2 years ago
Read 2 more answers
A body performing Shm has a velacity of 12m/s when the displacement is 100mm the displacement
Assoli18 [71]

Answer:

vjcyfuy

Explanation:

yjvjy

4 0
3 years ago
Many professional photographers take pictures of people. What skills would someone have to have to be successful in these types
Galina-37 [17]
Wedding photographer
you are taking pictures of large groups of all kinds of people from 2 different sides of a family 

could you add me as best answer if this is correct?

7 0
3 years ago
Cómo se puede evitar que desparescan los recursos de la zona de Michoacán
Aliun [14]
This should be put in the Spanish section <span />
8 0
3 years ago
Other questions:
  • Lydia used software and numerical data to create bar graphs. What software did she use?
    8·2 answers
  • In which scenario would instant messaging be more useful than other forms of communication?
    10·1 answer
  • How do most database users perform data searches?
    6·1 answer
  • Gina works in an SDLC team. When Gina makes changes to a file, no one else is allowed to acess it. Which type of version control
    10·1 answer
  • I wanna start answering questions for people, but I don't quite know how. Can you help me?​
    13·1 answer
  • Which is slower RAM or the CPU?
    11·2 answers
  • Gta! ! ! !!aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    11·2 answers
  • How do you know if something is in the public domain
    5·1 answer
  • How many types of window in Qbasic​
    7·1 answer
  • Attackers will sometimes put malware on USB drives and leave them in parking lots
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!