lAB TASK 7
lAB TASK 7
Programming
CIS-101
Fall 2022
Lab Report no.
Obtained Marks
Total Marks
Student Name
RAYYAN QUDDUSI
Section:
Experiment No: 7 Date of Submission:
Batch: Teacher:
BSEE 2024-28 Dr. Muhammad Tufail
Semester Lab Engineer:
1st Mr. Adam Abbas
Mr. M Hunzilah Ahmad
CODE:
#include<iostream>;
using namespace std;
int table(int i);
int main()
{
int n,z;
cout << "Enter any value between 1 and 10 : ";
cin >> n;
if (n >= 1 && n <= 10)
{
z = table(n);
cout << z;
}
else {
cout << "invalid input ";
}
}
int table(int i)
{
int x;
for (int n = 1; n <=10; n++)
{
x = i * n;
cout << i << " * " << n << " = " << x << endl;
}
return x ;
}
OUTPUT:
TASK : 2
CODE:
#include<iostream>
using namespace std;
int product(int a, int b);
int main() {
int x, y;
cout << "Enter any two numbers : ";
cin >> x >> y;
int i;
i = x * y;
cout << "Product : " << i;
}
int product(int a, int b)
{
int z;
z = a * b;
return z;
}
OUTPUT:
Task: 3
Code :
#include<iostream>
using namespace std;
int check(int a);
int main() {
int num;
cout << "Enter any value you wanna check : ";
cin >> num;
int res;
res = check(num);
if (res == 1) {
cout << "positive";
}
else {
cout << "negative ";
}
}
int check(int a)
{
if (a > 0)
{
return 1;
}
else {
return 0;
}
}
OUTPUT:
TASK : 4
CODE :
#include<iostream>
using namespace std;
int loop(int a);
int main() {
int num;
cout << "Enter any value you wanna run loop : ";
cin >> num;
loop(num);
}
int loop(int a)
{
for (int i = 1; i <= a; i++)
{
cout << i << endl;
}
return 0;
}
OUTPUT: