Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Algorithms and Programming COMP151

Similar presentations


Presentation on theme: "Introduction to Algorithms and Programming COMP151"— Presentation transcript:

1 Introduction to Algorithms and Programming COMP151
LAB 3 pattern printing Introduction to Algorithms and Programming COMP151

2 Exercise 1: Print the following : " " " " " " " " " "

3 #include<iostream>
using namespace std; int main() { cout<<"\"\n"; cout<<"\"\t\"\n"; cout<<"\"\t\"\t\"\n"; cout<<"\"\t\"\t\"\t\"\n"; cout<<"\"\t\"\t\"\t\"\t\"\n"; return(0); }

4 Exercise 2: Print the following: ???????????

5 #include<iostream>
using namespace std; int main() { cout<<"\?\?\?\?\?\?\?\?\?\?\?\n"; cout<<" \?\?\?\?\?\?\?\?\?\?\?\n"; return(0); }

6 Exercise 3: Print the following: * * * * * * * * * *

7 #include<iostream>
using namespace std; int main() { cout<<"\t\t\t*\n"; cout<<"\t\t*\t\t*\n"; cout<<"\t*\t\t*\t\t*\n"; cout<<"*\t\t*\t\t*\t\t*\n"; return(0); }

8 Exercise 4: Print the following: * ** ***

9 #include<iostream>
using namespace std; int main() { cout<<" \*\n"; cout<<" \* \*\n"; cout<<" \* \* \*\n"; return(0); }


Download ppt "Introduction to Algorithms and Programming COMP151"

Similar presentations


Ads by Google