Systems Programming HW 1 Solved

$24.99 $18.99

Objectives Practice C Programming intro332532 (n) Write the function intro332532 that takes a positive integer n and prints a string according to the following conditions if n is divisible by 5, it should print “UAB” if n is divisible by 3, it should print “CS” if n is divisible by both 3 and 5, it…

5/5 – (2 votes)

You’ll get a: zip file solution

 

Description

5/5 – (2 votes)

Objectives

Practice C Programming

intro332532 (n)

Write the function intro332532 that takes a positive integer n and prints a string according to the following conditions

  • if n is divisible by 5, it should print “UAB”

  • if n is divisible by 3, it should print “CS”

  • if n is divisible by both 3 and 5, it should print “UAB CS 332&532”

  • if n is a prime number other than 3 or 5 it should print “Go Blazers”

  • otherwise, it should print the cube of n

UABNumber()

Write the function UABNumber that will ask user to enter an integer and assign this value to a an integer variable n2. Your function will return a Boolean value (True or False). You will consider a number is a UABNumber if the value of the number is equal to the sum of its positive divisors. Your function will consider the input value and return True if the input parameter is a UABNumber, it will return False otherwise. While finding the positive divisors, do not include the number itself and assume n is equal or greater than 0.

reverseNum(n3)

Write the function “reverseNum” that takes an integer n3 and returns another integer. The function will reverse the order of the digits and return the new value. Assume the input will contain the positive integers only

Sample Input:

Expected Output:

n3 = 1234

4321

n3 = 29

92

n3 = 10001

10001

smallerThanIndex()

Write the function smallerThanIndex() that takes an array of integers (numbers) and return an integer. The function will check every number’s value and their indices. Count the number of integers in the array whose value is smaller than index and return the total.

+10 Bonus points: Use pointers to manipulate the array

arrayDetails()

Write a function arrayDetails that takes in aan integer array arr and returns another array containing (in the following order) the number of elements in the array, the minimum value, the minimum value’s index, the mean (rounded to the nearest hundredth), the maximum value and the maximum value’s index (total of six elements). Assume that the input will always be an array of integers. Built-in-methods and functions are permitted.

Sample input:

arr = [-8, -23, 18, 103, 0, 1, -4, 631, 3, -41, 5]

Sample Output:

[11, -41, 9, 62.27, 631, 7]

Systems Programming HW 1 Solved
$24.99 $18.99