Levels Tought:
Elementary,Middle School,High School,College,University,PHD
Teaching Since: | Apr 2017 |
Last Sign in: | 11 Weeks Ago, 6 Days Ago |
Questions Answered: | 4870 |
Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Part A: 10 pts
Â
Write a program in C that will print the following using only loop.
Â
**********
**********
**********
**********
**********
Â
Part B: 10 pts
Â
Write a program in C that will print the following using only loop.
Â
       *
     **
   ***
 ****
*****
Â
Part C: 10 pts
Â
Write a program in C that will print the following using only loop.
Â
Â
*Â Â Â Â Â Â Â Â Â Â Â *
**Â Â Â Â Â Â Â Â **
***Â Â Â Â Â ***
****Â Â ****
**********
Â
Part D: 10 pts
Â
// Program to reverse the digits of a number
Â
#include <stdio.h>
Â
int main ()
{
    int number, right_digit;
Â
    printf ("Enter your number.n");
    scanf ("%i", &number);
Â
    do {
        right_digit = number % 10;
        printf ("%i", right_digit);
        number = number / 10;
    }
    while ( number != 0 );
Â
    printf ("n");
Â
    return 0;
}
Â
The given program will accept an user input and display the reversed digits (ie. if the user entered 593 then it would display 395). However, this program does not function well if you type in a negative number. Find out what happens in such a case and then modify the program so that negative numbers are correctly handled. For example, if the number −8645 is typed in, the output of the program should be 5468−.
Â
Â
Part E: 10 pts
Â
Write a program that calculates the sum of the digits of an integer. For example, the sum of the digits of the number 2155 is 2 + 1 + 5 + 5 or 13. The program should accept any arbitrary integer typed in by the user. You should keep excepting user entry until the user types in a negative number (i.e. -1 or -2.)
Â
Â
Due Date:Â Â February 29th 2016 by Midnight
Â
Â
Â
Â
Requirements:
1. The program must follow the indentation rules. (use the provided code snippet in Assignment 3 as guide)
2. The program must be properly documented. (use the provided code snippet in Assignment 3 as guide)
3. All the declaration must be meaningful not just gibberish. (use the provided code snippet in Assignment 3 as guide)
4. Develop an algorithm to accomplish the coin counter challenge and implement it.
5. You may not use your classmate's algorithm as your own.
6. You may not copy an algorithm you found on the internet.