0% found this document useful (0 votes)
139 views11 pages

Technical Summative Assessment 5

The document provides instructions for a programming assignment on operators, expressions, and input/output operations in C language. It includes 7 tasks: 1) declaring and printing variables, 2) calculating average of 3 numbers, 3) finding greatest of 3 numbers, 4) rewriting expressions with proper precedence, 5) currency conversion, 6) unit conversion, and 7) examples of different operators. The assignment aims to help students understand input/output, operators, and writing programs to perform calculations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
139 views11 pages

Technical Summative Assessment 5

The document provides instructions for a programming assignment on operators, expressions, and input/output operations in C language. It includes 7 tasks: 1) declaring and printing variables, 2) calculating average of 3 numbers, 3) finding greatest of 3 numbers, 4) rewriting expressions with proper precedence, 5) currency conversion, 6) unit conversion, and 7) examples of different operators. The assignment aims to help students understand input/output, operators, and writing programs to perform calculations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 11

CE0002L

(Computer Fundamentals and Programming)

SUMMATIVE

5
OPERATORS, EXPRESSIONS AND INPUT/OUTPUT
OPERATIONS

Name of Student: Name of Professor:


Bermudo, Jannelle Elielah M. Anthony Aquino
Date Performed: Date Submitted:
October 10, 2021 October 10, 2021
I. OBJECTIVES

At the end of the experiment students must be able to:

a.) understand the input-process-output


b.) understand how operators are used
c.) identify the different operators
d.) construct a program that asks inputs from user, uses different operators and performs
calculations with the use of different operators.
e.) appreciate the concept behind operators.

II. BACKGROUND INFORMATION

Use unary and arithmetic operators for basic mathematical operations


• Use string operator to concatenate strings
• Use relational operators to compare objects
• Use logical operators to compare boolean values
• Use assignment operators to assign values to variables

III. PROCEDURE:

1. Declaring and printing variables. Given the table below, declare the following variables
with the corresponding data types and initialization values. Output to the screen the variable names
together with the values.

a. The following should be the expected screen output,


i. Number = 10
ii. letter = a
iii. result = true
iv. str = hello

Source Code:

#include <stdio.h>
#include <stdbool.h>

void main()
{
//Variable declaration code here...

int number = 10;


char letter = 'a';
bool result = true;
char str[] = "hello";

//Printing code here...

printf("number = %d\n",number);
printf("letter = %c\n",letter);
result?printf("Result = true\n") : printf("false");
printf("str = %s\n",str);
}
Screenshot of OUTPUT:

NOTE: Attach your C language program in your submission.


2. Getting the average of three numbers. Create a program that outputs the average of three
numbers. Let the values of the three numbers be, 10, 20 and 45. The expected screen output is,
number 1 = 10
number 2 = 20
number 3 = 45
3. Output Average
greatestisvalue.
= 25 Given three numbers, write a program that outputs the number with the
greatest value among the three. Use the conditional ?: operator that we have studied so far (HINT:
You will need to use two sets of ?: to solve this). For example, given the numbers 10, 23 and 5,
Source Code:
your program should output,
number 1 = 10
number 2 = 23
number 3 = 5
The highest number is = 23

Source Code:

Screenshot of OUTPUT:

NOTE: Attach your C language program in your submission.


2 Operator precedence. Given the following expressions, re-write them by writing some parenthesis
based on the sequence on how they will be evaluated.

1. a / b ^ c ^ d – e + f – g * h + i
Answer:

2. 3 * 10 *2 / 15 – 2 + 4 ^ 2 ^ 2
Answer:

3. r ^ s * t / u – v + w ^ x – y++
Answer:

5. The user will input a Philippine amount, then the said amount will be converted to different currencies
namely: US Dollar, Euro, Yuan, Koruna, Krone, Sheqel and Dinar

Sample run:
Enter Philippine peso: 43.33089

The amount's equivalent to:


US Dollar is : 1.000
Euro : 0.734719
Yuan : 6.346934
Koruna : 18.77263
Krone : 5.449007
Sheqel : 3.726334
Dinar : 0.274588

Suppose, 1.000 US Dollar is equivalent to Php. 43.33089, 0.734719Euro, 6.346934 Yuan, 18.77263
Koruna, 5.449007 Krone, 3.726334 Sheqel, and 0.274588 Dinar.

Source Code:
Source Code:

Screenshot of OUTPUT:

NOTE: Attach your C language program in your submission.


6. Create a program that will convert:
6.1 Degree Fahrenheit to degree celsius and vice versa.
6.2 Centimeter to Meter, decimeter, kilometer, decameter and millimeter.

Source Code:

Screenshot of OUTPUT:

NOTE: Attach your C language program in your submission.


7. Write a program to give the examples of operators.
7.1 Increment and decrement operators.
7.2 Bitwise Complement Operator.
7.3 Arithmetic operator.
7.4 Relational Operator
7.5 Bitwise operator.
7.6 Conditional Operator.

Source Code:

Screenshot of OUTPUT:

NOTE: Attach your C language program in your submission.


IV. QUESTION AND ANSWER

1. Which of the four arithmetic operators can operate on string as well as numeric operands?
______________________________________________________________________________
______________________________________________________________________________
_____________________________________________________________________________

2. Assuming total is a variable, how else could you express in code total = total +2?

______________________________________________________________________________
______________________________________________________________________________
_____________________________________________________________________________

VI. Assessment

Department Computer Science Department


Subject Code CE0002L
Description Computer Fundamentals and Programming
Term/Academic Year 1 / 2020-2021

Topic Basic Input Output Operations


and Arithmetic Expressions
Lab Summative 5
No.
Lab Summative Operators and expressions,
Input/Output Operations
CLO 2,3,4

Note: The following rubrics/metrics will be used to grade students’ output in the Lab
Summative 5.

Criteria Descriptions Points


Task no 1 The variables and the corresponding values are properly 10
assigned and used in the program.
Task no 2 The program should get the average of 3 numbers. The values 10
for the numbers given are used, and the output on the screen
should be the same as stated on the question.
Task no 3 Uses the ?: operator to get the greatest value among the 3 10
numbers dynamically, meaning the numbers should come from
the user and it could be any random number
Task no 4 The expressions given should be converted to an expression with 10
parenthesis based on their precedence
Task no 5 The program should convert a Philippine currency to different 10
currencies
Task no 6 The program should convert the different type of measurement 10
to another type
Task no 7 The program should encorporate all of the given operators. 10
Error in the The program made is free of errors and bugs. 15
program
Output The output of the program is correct and solved based on the 15
problem stated.
Total 100%

You might also like