CS201P assignment 1 solution 2022 file download.
you can download CS201P assignment file latest 2022 solution for fall 2022 students.
in This file you will get the solution of problem given in LMS assignment section.
Problem Statement:
Sometimes in
programming, there may be a need to run a block of code repeatedly. In general,
the programming statements are executed in
order. Different control structures offered by programming languages allow for
more complex execution paths. A loop statement allows us to execute a statement
or collection of statements multiple times. Conditional branching statement
(if-else), on the other hand, controls the flow of execution of statements
based on some condition. If the given condition is true, the code inside IF
block is executed, otherwise Else block code is executed.
Now keeping in mind, the above discussed
concepts,write a C++ program using FOR loop
and If-Else statement that performs the
following tasks:
1.
Print your VU Id.
2.
Add first and last numeric
digit of VU Id, and store the result in variable “sum”.
3.
Display the result of sum on screen.
4.
If sum is greater than 7 then print the “Welcome to VU”. Number of iterations of FOR loop should be equal to
the sum.
5.
If sum is less than 7 then print the “Welcome to CS201P”. Number of iterations of FOR loop
should be equal to the sum.
For example, suppose the student id is BC123456781. Then by adding first
and last numeric digit of VU Id,
we get the value of 2. In this case, program should print “Welcome to
CS201P” for 2 times using FOR loop
and vice versa.
Solution Code: