Skip to content

jaredwassermanCPRF/Assignment2

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Assignment 2

Objectives

To gain a solid understanding of Operators, System Input/Output, Conditional Statements, and Relational and Boolean Operators.

Part 1

  1. Write a program evenodd.c to check if a user-input number is even or odd. You can assume the user enters an integer.
  2. Write a program threenums.c that takes in 3 user-input numbers and prints “numbers are equal” if all 3 numbers are equal, and “not equal”, followed by the largest number, if the numbers are not equal. Then print out the sum of the 3 numbers.

Part 2

  1. What is the outcome of the following conditional statements if the value of variable x is 5? Show your work.

    a. x <= 4 || (x != 9 && x > 10)

    b. x > 0 && x < 10 && x != 6

    c. x == 1 || x > 0

  2. Can we use string value/variable in switch test condition? Why or why not?

  3. What is wrong with the following code snippet? As written, what will it do?

			int userIn;
			scanf(“%d”, userIn);

Submission Guidelines

Please include your name and a description in a comment at the top of your code files. Please also include your name at the top of your assignment2.txt file.

All files must be submitted via GitHub by 10:00am 7/22.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 100.0%