0% found this document useful (0 votes)
8 views

Lab 3 - For-while loop

This document outlines Lab 3 for the CCCS 111 course at the University of Jeddah, focusing on For-while loops. It includes objectives for programming exercises, specifically creating programs that count multiples of 5 and allow user-defined counting increments. The lab is graded out of 1 mark, with specific criteria for input validation and output formatting.

Uploaded by

ABOD GAMER
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)
8 views

Lab 3 - For-while loop

This document outlines Lab 3 for the CCCS 111 course at the University of Jeddah, focusing on For-while loops. It includes objectives for programming exercises, specifically creating programs that count multiples of 5 and allow user-defined counting increments. The lab is graded out of 1 mark, with specific criteria for input validation and output formatting.

Uploaded by

ABOD GAMER
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/ 2

Kingdom of Saudi Arabia ‫المملكة العربية السعودية‬

Ministry of Education ‫وزارة التعليم‬


University of Jeddah ‫جامعة جدّة‬
College of Science and Computer Engineering
‫كلية علوم و هندسة الحاسب‬

CCCS 111 – Introduction to Programming

LAB 3

Topic:
For-while Loop

Total Marks: 1

Student Name: __________________________________


Student ID: _____________________________________

Marks:

Exercise 1 2 Total

Allocated 0.5 0.5 1

Obtained

CLO, PLO 2.2, S2 2.2, S2

CLO Marks:
CLO2.2, S2 Total
Allocated 1 1
Obtained
Kingdom of Saudi Arabia ‫المملكة العربية السعودية‬
Ministry of Education ‫وزارة التعليم‬
University of Jeddah ‫جامعة جدّة‬
College of Science and Computer Engineering
‫كلية علوم و هندسة الحاسب‬

Objectives
1 Ability to receive input from keyboard
2 Use the printf statement as an alternative to cout.
3 Ability to use For loop
4 Ability to use Do-while loop

Program 1: [CLO2.2, S2, 0.5 Mark]


• Create a program called CountUpBy5.

• Input: The program should accept a positive integer 𝑛 from the user as input. If the given
input is not a positive input it should prompt the user to retry

• Hint: use a While-loop for this

• Output: The program should then count all numbers from 0 up to 𝑛 that are multiples of 5
and print them out on a single line on the screen.

• Hint: use a For-loop or a While-loop for this

Program 2: [CLO2.2, S2, 0.5 Mark]


• Modify the CountUpBy5 program in Part 1 and call it CountByC to accept another
number C, by which it will count up to n, the second user provided number.

• Obviously, you have to ensure that C is greater than 0.

• C may also be a fraction, and does not need to be am integer.

You might also like