0% found this document useful (0 votes)
31 views4 pages

lAB TASK 7

C++ codes

Uploaded by

rayyanquddusi683
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views4 pages

lAB TASK 7

C++ codes

Uploaded by

rayyanquddusi683
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Computer Fundamental and

Programming
CIS-101
Fall 2022
Lab Report no.
Obtained Marks
Total Marks

Lab Engineer Signature &


Comments

Student Name
RAYYAN QUDDUSI

Section:
Experiment No: 7 Date of Submission:

Experiment Title: FUNCTIONS


[Title]

Batch: Teacher:
BSEE 2024-28 Dr. Muhammad Tufail
Semester Lab Engineer:
1st Mr. Adam Abbas
Mr. M Hunzilah Ahmad

Department of Electrical Engineering


LAB TASK : 7
TASK : 1

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:

You might also like