Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 3

Assignment No.

01
Semester: Spring 2014
CS201: Introduction to Programming
Total Marks: 20
ue ate: 14
t!
Ma"# 2014
Instructions:
Please read the following instructions carefully before submitting assignment. It should be clear that your
assignment will not get any credit if:
The assignment is submitted after due date.
The submitted assignment does not open or file is corrupt.
Assignment is copied(partial or full) from any source (websites, forums, students, etc)
Note: ou ha!e to upload only .cpp file. Assignment in any other format (e"tension) will not be accepted and
will be awarded with #ero mar$s. %or e"ample, if you submit code in .doc (&ord document) or .t"t files or .e"e
file, no reward will be gi!en in any case.
$%&ecti'e:
The ob'ecti!e of this assignment is to pro!ide hands on e"perience of:
(asic concepts of )*)++ language and Programming
,ealing with ,ata types
)onditional statements of )*)++ language
-epetition .tructures (/oop)
.witch statement
(uidelines:
)ode should be properly indented and well commented.
%ollow )*)++ rules while writing !ariable names, function names etc
0se only de!1)++ for this assignment.
Assignment
Pro%lem Statement:
ou are re2uired to write a )++ program using loop and switch statement. The program should display e!en or
odd numbers from 3 to 45 depending upon the option gi!en by the user.
etailed escription:
The program should prompt the user for one character option (either 6e7, 687 or 6o7, 697).
It should respond in the following ways:
If user enters character option 6e7 or 687 then it should display the e!en numbers from 3 to 45.
If user enters character option 6o7 or 697 then it should display the odd numbers from 3 to 45.
Sample output o) t!e program:
If user enters 6e7 then it displays the e!en numbers from 3 to 45.
If user enters 687 then it displays the e!en numbers from 3 to 45.
If user enters 6o7 then it displays the odd numbers from 3 to 45.
If user enters 697 then it displays the odd numbers from 3 to 45.

You might also like