You are on page 1of 4

LabTask05

Course: CP - BM
Marks: 10
Instructor: Rimsha Javed
ID: SP22-BSCS -0067

Q:01 //Q:1

//Hishmat sp22-bscs-0067

#include <iostream>

using namespace std;

int main(){

int n;

cout<<"Enter the number less than


100:"<<endl;

cin>>n;

if(n<=100){

for(int i=1;i<=n;i++){

if(n%9==0){

cout<<i<<endl;

}
else{

cout<<"give only less than or


equal to 100"<<endl;

Q:02 //Q:2

//Hishmat sp22-bscs-0067

#include <iostream>

using namespace std;

int main()

int n;

int ending_point;

cout << "Enter a positive integer:


"<<endl;//taking inpput for table from user

cin >> n;

cout << "Enter the ending point:


"<<endl;//taking input from user to which
number you want the table

cin>>ending_point;
for (int i = 1; i <= ending_point; ++i) {

cout << n << " * " << i << " = " << n * i <<
endl;

return 0;

Q:3 //Q:3

//Hishmat sp22-bscs-0067

#include <iostream>

using namespace std;

int main(){

int n;

int factorial=1;

int i;

cout<<"Enter the number";

cin>>n;

if(n<0){

cout<<"Error! there can't be


factorial of negative numbers"<<endl;

else{

for(i=n;i>=1;i--)
factorial=factorial*i;

cout<<"factorial="<<n<<"="<<factorial<<endl;

cout<<endl;

You might also like