Skip to content

SYST 44288 - Operating System Design and Implementation

Notifications You must be signed in to change notification settings

stemmlerjs/os-design-assign-1

Repository files navigation

Assignment 1

Author: Khalil Stemmler

Hello!

Each part of the Assignment is contained in it's respective folder. Each folder contains:

  • the C code
  • an output.txt file demonstrating proof of functionality

Cheers.

Requirements

Complete the following programs in the C programming language. Programs should be commented where necessary.

  1. (2 points) (Armstrong Numbers) Number n is called Armstrong’s number of order k if it is equal to the sum of k-th powers of its digits. (For example: 371 = 33 + 7 3 + 13 Armstrong’s number of order 3.) Write C program which prints all the Armstrong’s numbers of a given order k, within the given interval between p and q, where k, p, and q are integers entered by the user by means of standard input (ie. typed on the command line). Output should consist of a single number per line with no extra or blank lines.

  2. (2 points) Let n be a positive integer. Euler’s phi-function φ(n) is defined to be the number of positive integers not exceeding n that are relatively prime to n. Write a program that can be used to calculate and display the value of Euler’s phi-function for a series of positive integer, separated by spaces, entered on the command line.

  3. (2 points) Using pointers and avoiding unnecessary local variables, write a function, rmchr that takes a string and a character as arguments. The rmchr function should remove all occurrences of the character from the string. The rmchr function should not leave spaces characters in the string where characters have been removed. The resulting string should be returned using an appropriate data type, not printed to the command line.

  4. (2 points) Using pointers and avoiding unnecessary local variables, write a function, rmstr that takes two strings as arguments, removing all occurrences of any character from the second string in the first string. The rmstr function should not leave spaces characters in the string where characters have been removed. The resulting string should be returned using an appropriate data type, not printed to the command line.

About

SYST 44288 - Operating System Design and Implementation

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages