EC413-Lab 0 C Programming Language Solved

30.00 $

Category:

Description

Rate this product

1.1       Problem 1

Write a C program that accepts an integer from standard input and prints it out as an unsigned binary number. Assume the input integer is 32 bits long. All 32 bits of the integer should be printed (including leading zeros).

Example input, output pairs:

  • 1 → 00000000000000000000000000000001
  • 74 → 00000000000000000000000001001010
  • 1042 → 00000000000000000000010000010010

1.2       Problem 2

Write a C program that accepts a string from standard input representing a signed 16 bit integer and returns the base10 value of the input.

Example input, output pairs:

  • 00100010 11010111 → 8919
  • 11111111 11110001 → -15
  • 11111100 00000000 → -1024

1.3       Problem 3

Write a C program that accepts an 16 bit hex number from standard input and returns unsigned decimal number.

Example input, output pairs:

  • ABAD → 43949
  • 9AD7 → 39639
  • 1234 → 4660

1.4       Problem 4

Write a C Program that accepts an unsigned integer n from standard input and outputs the n-th Fibonacci’s number.

Example input, output pairs:

  • 0 → 0
  • 1 → 1
  • 2 → 1
  • 3 → 2
  • 4 → 3
  • 8 → 21
  • 17 → 1597

1.5       Problem 5

Write a program that accepts an unsigned integer n through standard input. This argument determines the size of an array. Next, accept n more unsigned integers from standard input to fill the array. Sort the array ascending using the algorithm of choice. Afterwards, implement a filter function that accepts one argument and builds another array that contains only the elements greater than the given number. The argument of filter function should be passed as the last standard input of your program. Print the filtered array to the output. Example input, output pairs:

  • 5 1 5 8 7 2 5 → 7 8 // Accepts 5 inputs [1, 5, 8, 7, 2], sorts the array and returns the numbers greater than five SEPARATED WITH A SPACE.
  • 6 4 5 7 1 3 4 3 → 4 4 5 7 // You should return both 4’s
  • lab0-0qq2m9.zip