Design how to do the logic in your own words first

Assignment Help C/C++ Programming
Reference no: EM131215870

Objectives

- Gain experience with if, if else, and switch statements in C programs.
- Experience using % operator and true false logic.

Hints

This program will be MUCH easier if you design how to do the logic in your own words first. Do not even think about C until you understand the true false logic and the arithmetic needed to do it. Make sure you have a formula or a plan to calculate each case.

The program

The user types in two numbers to find if the first is evenly divisible by the second.

The program will output:
<first> is evenly divisible by <second>
Or
<first> is <value> too large to be evenly divisible by <second>. The closest number is <number>.
Or
<first> is <value> too small to be evenly divisible by <second>. The closest number is <number>.
Or
<first> is <value> off, in the middle from <lower number> or <larger number>

Examples:
User types 49 and 7.
49 is evenly divisible by 7.
User types 50 and 7.
50 is too large to be evenly divisible by 7. The closest number is 49.
User types 55 and 7.
55 is too small to be evenly divisible by 7. The closest number is 56.
User types 52 and 8.
52 is 4 off, in the middle from 48 or 56.

Rules:

You must use nested if, else if statements to do your logic.

The program must only return at one place, the bottom of main(), with no exit() and no break statements.

Rules for programming assignments

If you break any of these rules your will receive a 0 on your assignment and will have to rewrite it and resubmit.

1. All variables must be declared BEFORE ANY CODE.

2. No variables declared in loops like for(int x; The int x must be at the top of your code. See rule 1.

3. No use of break or continue in loops.

4. Functions that return a value must have one and only one return statement, the last line in the function.

5. All variable must have meaningful names. For rows and columns must be r and c or row and col or row and column. Not i, j, a, b or anything not meaning full.

6. Code must be properly indented and formatted.

7. All assignments must have comments at the top that:
a. Name of assignment, class, and the date.
b. Name of the author: that would be you

Reference no: EM131215870

Questions Cloud

How starbucks strategies have changed since its early days : Discuss how Starbucks' strategies have changed since its early days? Discuss how Dunkin' Donuts' strategies have changed since its early days?
Advantage to making lifetime transfer of property to donee : Which of the following is an advantage to making a lifetime transfer of property to a donee?
Examine the black box component : Link up two different signals by means of the mathematics component - for instance, addition or multiplication - and look at all three signals one below the other on the same screen.
Stockholders equity section of balance sheet : Stockholders’ Equity Section of Balance Sheet) The following is a summary of all relevant trans- actions of Vicario Corporation since it was organized in 2014. In 2014, 15,000 shares were authorized and 7,000 shares of common stock ($50 par value) we..
Design how to do the logic in your own words first : Design how to do the logic in your own words first. Do not even think about C until you understand the true false logic and the arithmetic needed to do it. Make sure you have a formula or a plan to calculate each case.
Do you think we have become a culture of photographs : How has the ability to take a photograph changed from Daguerre to today (with phones)? Do you think we have become a culture of photographs? How?
What do you advise burt about the validity of his agency : What do you advise Burt about the validity of his agency agreement with Amy and why? Explain your rationale in detail. What do you advise Burt about Tours' authority to make reservations/contracts on his behalf and why?
How to set the block format and the sample frequency : Find out how to set the block format and the sample frequency in the menu (A/D). What exactly do these two quantities indicate?
Reason person would prefer to be independent contractor : Which of the following is a reason a person would prefer to be an independent contractor?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Write a program to implement a menu driven application

Write a C or C++ program to implement a menu driven application which will maintain a list of car models, their price, name of the manufacturer, engine capacity etc., as a doubly linked list

  Q1 write a program that generates the following

q1. write a program that generates the following outputnbspnbspnbspnbspnbspnbspnbspnbsp 10nbspnbspnbspnbspnbspnbspnbsp

  Create a program that stores names in an array

In c++ create a program that stores names in an array. Also the program will end when "quit" is entered. Use a menu with the options: getName, sortName,displayName, findName, removeName.

  Program to create a game named chess

Create table game characters 8x8, where will store THE POSITION OF Figure each time on this chessboard. The creation of the list must be made with commitment memory. In addition create structure (struct move) to be used for the registration moveme..

  Write recursive boolean method to accept array and value

Write down the recursive boolean method named isMember. The method must accept two arguments: an array and a value. Method must return true if value is found in array.

  Show the dealer hole card until after the player stands

Do not show the dealer hole card until after the player stands, and do not show the dealer score until after the player stands. After the player stands, playout the dealer according to the rules = 17 stand.

  Create a template class

Create a template class, SVector, that implements a constructor

  Write a program that sorts a linked list

Write a program that sorts a linked list of integers using merge sort. the program will read the integers froma file onto a linked list and then sort the linked list using MERGE SORT. this will require additional linked lists but you should use li..

  Write a literal representing the long integer

Write a literal representing the long integer value twelve billion.

  Change this code to read in strings from a text file

code takes in a string from a user, checks if the paranthesis are ballanced (as defined by my class) and also returns the variable from my line (also from my class). All like to change this code to read in strings from a text file (each line is a str..

  Write a C program that prints an n by n magic square

Write a C program that prints an n by n "magic square" (a square arrangement of the numbers 1, 2, ..., n2 in which the sums of the rows, columns, and diagonals are all the same). The user will specify the value of n.

  Create a class named gamer that has a field for name

Create a class named Gamer that has a field for name(string) and a field for points(int).

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd