Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Programming Assignment for Introduction to Systems Software & Programming in C, Assignments of Engineering

Instructions and programming assignments for students in the introduction to systems software & programming course at the university of pittsburgh. The assignments involve writing c programs to perform various mathematical operations, such as calculating the power of a number, determining if a number is a palindrome, and finding the decimal equivalent of a binary number. Students are required to submit their assignments electronically before the due date.

Typology: Assignments

Pre 2010

Uploaded on 09/02/2009

koofers-user-8n5
koofers-user-8n5 🇺🇸

5

(1)

10 documents

1 / 2

Toggle sidebar

Related documents


Partial preview of the text

Download Programming Assignment for Introduction to Systems Software & Programming in C and more Assignments Engineering in PDF only on Docsity! CS/COE 0449 Introduction to Systems Software & Programming Programming Assignment-1 Due Thursday Jan.18 by 11:59pm Directions: Submit an electronic copy of this assignment to the course ftp-submission site.  Pack all the assignment files to a FirstName_LastNameAssign1.zip file, using WinZip or a similar application.  Submit the zipped package by using the computer science department's anonymous FTP server (cs.pitt.edu/incoming/CS449/ or ftp://ftp.cs.pitt.edu/incoming/CS449/). Please make sure to submit to the project number directory.  Submission must be before the due date, otherwise, it will be considered late. Once you submit, you can't take the file back! Therefore, please submit your final program and only one time. 1. Write a C program that calculates x raised to the y power. The program should have a while repetition control structure. Start writing this program by using the following: a) Input integer variable x with scanf. b) Input integer variable y with scanf. c) Initialize integer variable i to 1. d) Initialize integer variable power to 1. e) Multiply variable power by x and assign the result to power. f) Increment variable i by 1. g) Test i to see if it is less than or equal to y in the condition of a while statement. h) Output integer variable power with printf. i) Initialize integer variable i to 1. 2. Write a C program that inputs one five-digit number, separates the number into its individual digits and prints the digits separated from one another by three spaces each. [Hint Use the combinations of integer division and remainder operation.] For example, if the user types in 42139, the program should print: 4 2 1 3 9 3. A palindrome is a number or a text phrase that reads the same backward as forward. For example, each of the following five-digit integers is a palindrome: 12321, 55555, 45554, 11611. Write a C program that reads in a five-digit integer and determines whether or not it is a palindrome. [Hint Use the division and remainder operators to separate the number into its individual digits.] 4. Input an integer containing only 0s and 1s (i.e. “binary” integer) and print its decimal equivalent. [Hint: Use the remainder and division operators to pick off the “binary” number’s digits one at a time from right to left. Just as in the decimal number system, in which the rightmost digit has a positional value of 1, and the next digit left has a positional value of 10, then 100, then 1000, and so on, in the binary number system the rightmost digit has a positional value of 1, the next digit left has a positional value of 2, then 4, then 8, and so on. Thus the decimal number 234 can be interpreted as 4 * 1 + 3 * 10 + 2 * 100. The decimal equivalent of binary 1101 is 1 * 1 + 0 * 2 + 1 * 4 + 1 * 8 or 1 + 0 + 4 + 8 or 13.]
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved