Download presentation
Presentation is loading. Please wait.
Published byBaldric Jordan Modified over 5 years ago
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); }
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.