0% found this document useful (0 votes)
9 views4 pages

Asm 01

The document outlines the assignment instructions for PRF192, requiring students to use specific software and follow a structured submission format. It includes detailed steps for answering four programming questions, each with specific requirements and sample inputs/outputs. Students must adhere to naming conventions and avoid modifying provided code to ensure proper grading.

Uploaded by

hmy101006
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views4 pages

Asm 01

The document outlines the assignment instructions for PRF192, requiring students to use specific software and follow a structured submission format. It includes detailed steps for answering four programming questions, each with specific requirements and sample inputs/outputs. Students must adhere to naming conventions and avoid modifying provided code to ensure proper grading.

Uploaded by

hmy101006
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

ASSIGNMENT 01 – PRF192

Duration: 90’
=====================================================================================
Software Requirements
• Dev C++ 5.11, NotePad, Command Prompt, WinRAR / WinZip with Windows Explorer
(File Explorer) on Windows 7 and above.
Instructions
• Step 1: Students download the given materials from LMS.
• Step 2: Students read questions and prepare answers in the given template.
• Step 3: Prepare to submit the answer:
o For each question (e.g., question Q1, Q2, Q3,…), please create two sub-folders: run and
src.
o Copy the *.exe file into the run folder, and the *.c file into the src folder.
• Step 4: Submit a solution for each question:
o Create a folder formatted: RollNumber_FullName_ASMxx (xx: 01, 02,..) that contains
folders (created Step 03 ) as the below figure:

o Use WinRAR / WinZip tool to compress the RollNumber_FullName_ASMxx folder and


submit it to LMS
❖ Importance:
o Do not change the names of the folders, files, and struct (format) of .c files specified in the
assignment. If you change it, the grading software can not find the execute file (.exe) or the output
results to score, thus the result will be 0
o Do not edit given statements in the main function. If you change, the grading software can not
score and the result will be 0.
=====================================================================================
Question 1: (2 marks)

The given file Q1.c already contains statements to input data for integer variables named number01,
number02, and a char variable named op (op is one of four operators +, -, *, / ). You should write
statements to print out the result of one of four the operators. If the number02 is 0 and op is the ‘/’
operator or op is an invalid operator then print out 0.00
Notes:
- Do not edit given statements in the main function
- You can create more functions if you see it is necessary.
- The output result is formatted in two decimal places
Sample input and output:

#Case 01 #Case 02
Input: number01 : 8, number02 : 3, op : / Input: number01 = 8, number02 = 0, op : /
After processing: result = 8 / 3 = 2.67 After processing: result = 0.00
Output for marking: Output for marking:
OUTPUT: OUTPUT:
2.67 0.00
#Case 03 #Case 04
Input: number01 : 8, number02 : 4, op : & Input: number01 : 8, number02 : 4, op : *
After processing: result = 0.00 After processing: result = 8 * 4 = 32
Output for marking: Output for marking:
OUTPUT: OUTPUT:
0.00 32
#Case 05 #Case 06
Input: number01 : 8, number02 : 4, op : + Input: number01 : 8, number02 : 4, op : -
After processing: result = 8+4 = 12 After processing: result = 8 - 4 = 4
Output for marking: Output for marking:
OUTPUT: OUTPUT:
12 4

Question 2: (3 marks)

The given file Q2.c already contains statements to input mark of the three subjects: math, physics and
chemistry. You should write statements to calculate the average of the subjects (avg) and rating by the
following formula:
1. If avg >= 8 and avg <= 10 then print out “1”
2. If avg >= 6.5 and avg < 8 then print out “2”
3. If avg >= 5 and avg < 6.5 then print out “3”
4. If avg >= 0 and avg < 5 then print out “4”
Notes:
- Do not edit given statements in the main function
- You can create new more functions if you see it is necessary.
Sample input and output:
Input: math = 8, physics = 6.5 , chemistry = 5.5
After processing: result = 2
Output for marking:
OUTPUT:
2

Question 3: (2 marks)

The given file Q3.c already contains statements to print out value of an integer variable named sumEvens
. You should write statements to calculate the sum of evens inputted from the keyboard until the value
0 is inputted , the result will be stored in the sumEvens variable.
Notes:
- Do not edit given statements in the main function
- You can create new more functions if you see it is necessary.
Sample input and output:

-Input:
2
3
4
5
0
After processing: 2+4= 6
Output for marking:
OUTPUT:
6

Question 4: (3 marks)

The given file Q4.c already contains statements to input characters from the keyboard until the character
‘#’ is inputted . You should write statements to count the number of characters are vowels then the result
will be stored in an integer variable named numberOfVowels.
Notes:
- Do not edit given statements in the main function
- You can create new functions if you see it is necessary.
- You can use toupper(ch) function to convert a character to uppercase ( in ctype.h)
- You can use isalpha(ch) function to check whether a character is an alphabet or not. ( in ctype.h)
Sample input and output:
Input:
A
d
a
E
#
After processing: number of vowels = 3
Output for marking:
OUTPUT:
3

You might also like