# CS201 Assignment 2 Solution Fall 2021 - VU Answer

In This Post, Provide CS201 Assignment 2 Solution Fall 2021. Easy to See Correct CS201 Assignment No 2 Solution Fall 2021 and Download Solution File with PDF, .CPP and Word Format Below.

## CS201 ASSIGNMENT 2 SOLUTION FALL 2021

Due Date: 23 Dec 2021

Total Marks: 20

Submit your assignment only in .cpp format

Assignment Objective:

To enable students to understand and practice the concepts of:

Data Types and Variables

If-else statements

Repetition structure

Loops and Operators

Arrays

Code Solution

// If you need a new fresh ready assignment with your id just WhatsApp 03162965677

#include<iostream>

using namespace std;

int main()

{

char st_FirstName = "Bilal"; // Student First Name

char st_lastName = "Khan"; // Student Last Name

char st_vuId = "MC190456213"; // Student ID

int scar_size = sizeof(st_FirstName)/sizeof(st_FirstName);

int ans_size = sizeof(st_vuId)/sizeof(st_vuId);

int scar_ans = 0, sumVD = 0;

cout << "My First Name: " << st_FirstName << endl; // Display first Name

cout << "My VU ID is: " << st_vuId; // Display VU ID

for(int i = 0; i < ans_size; i++)

{

if(st_vuId[i] >= 97 && st_vuId[i] <= 122 || st_vuId[i] >= 65 && st_vuId[i] <= 90 || st_vuId[i] >= 48 && st_vuId[i] <= 57)

{

scar_ans += 1;

}

}

cout << "\nLast Digit of my VU ID: " << st_vuId[scar_ans - 1] << endl; // last digit of vu id print

int l_scar = st_vuId[scar_ans - 1] - 48;

int scar = 0;

for(int i = 0; i < scar_size; i++)

{

if(st_FirstName[i] =='a' || st_FirstName[i] =='e' || st_FirstName[i] =='i' || st_FirstName[i] =='o' || st_FirstName[i]=='u' || st_FirstName[i] =='A' || st_FirstName[i] =='E' || st_FirstName[i] =='I' || st_FirstName[i] =='O' || st_FirstName[i] =='U')

{

scar += 1;

cout<<"\nVowel no " << scar << ": "<< st_FirstName[i]; // no of vowels in first name

}

}

cout << "\n";

sumVD = scar + l_scar;

cout << "\nTotal Vowels in my First Name: " << scar <<endl; // show total number of vowels in first name

cout<<""<<endl;

cout << "Sum of Vowels in first name and last digit of VUID: " << sumVD << endl;

cout << "\n";

if(sumVD % 2 == 0)

{

for(int i = 0; i < sumVD; ++i)

{

cout << " Iteration no: " << i + 1 << endl;

cout << "My First Name is: " << st_FirstName << endl;

}

}

else

{

for(int i = 0; i < sumVD; ++i)

{

cout << " Iteration no: " << i + 1 << endl;

cout << "My Last Name is " << st_lastName << endl;

}

}

return 0;

}

OUTPUT Check Also: