{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Homework3-2

# Homework3-2 - scanf"%d"&b*computing octal...

This preview shows page 1. Sign up to view the full content.

Homework #3 /* * Program hw3_2 * Written by Justin Waters * Inputs: an integer * Outputs: the integer in octal format * Description: The user enters a number and the program displays the number in octal format*/ #include <stdio.h> //printf, scanf defined #include <math.h> //math functions int main (void) { int b,c,d,e,f,g,h,i,j,k; //variables for octal computation /*gets a number from the user*/ printf("Enter a number between 0 and 32767:");
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: scanf("%d", &b); /*computing octal number from the user entered number*/ c = b / (8*8*8*8); d = b - (c*8*8*8*8); e = d / (8*8*8); f = d-(e*8*8*8); g = f / (8*8); h = f - (g*8*8); i = h / (8); j = h - (i*8); k = j / (1); /*displays computed octal number for the user*/ printf("In octal, your number is: %d%d%d%d%d ", c, e, g, i, k); return (0); }...
View Full Document

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern