Basic Building Blocks Solution

$30.00 $24.90


Create a C project “assignment-1” in Eclipse or another IDE. Create a source directory “src” in the project. Create an empty C file “assignment-1.c” and edit it to look like this:

 * @file assignment-1.c
 * @author  YOUR NAME
 * @date    THE DATE
 * This is the first programming assignment for CS 5001.
#include <stdbool.h>
#include <stdio.h>

 * The code in this function is the solution to the assignment.
int main(void) {
        // YOUR CODE HERE

Define and initialize the following variable or constant with the appropriate type and value. In some cases, you will use operators to compute the value.

  1. An unsigned integer constant squareOfThree initialized by calculating the square of 3

  2. A double precision floating point constant initialized to Euler’s constant 2.718281828459045

  3. A boolean variable isGreaterThan initialized to the logical expression 2.8 e

  4. An integer variable quotient initialized to the ratio of sum 2+4+5 divided by 3

  5. A short integer variable remainder that is the remainder of 11 with 3

  6. A double precision variable greaterValue that is 2.8 if isGreaterThan is true and e if isGreaterThan is false.

  7. A single precision floating point constant oneTenth initialized to the ratio of 1.0 divided by 10.0

  8. A character hex7A whose value is the hexadecimal constant 7A.

  9. A character constant charZ initialized to ‘Z’.

  10. An unsigned short variable numLetters that is the number of letters between ‘A’ and ‘Z’ inclusive.

For each variable or constant, provide a printf() statement using the apropriate field specifier that prints its name, its value, and its size in bytes.

Additional Exercises

Here are additional exercises that will give you more practice with the subject material in this module.

Coming soon.