You are on page 1of 4

CHANDIGARH UNIVERSITY

UNIVERSITY INSTITUTE OF ENGINEERING


DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING

Submitted By: Pranam Manav Upagade Submitted To: Er. Lisha Yugal
Subject Name Design Analysis
and Algorithm
Lab
Subject Code 20CSt-311

Branch BE CSE

Semester
5th
LAB INDEX

NAME: Pranam Manav Upagade SUBJECT NAME: Design Analysis and Algorithm
UID: 20BCS5455 SUBJECT CODE: 20CST-311
SECTION: 618-A

Sr. Program Date Evaluation Sign


No LW VV FW Total
(12) (8) (10) (30)
1.

2.

3.

4.

5.

6.

7.

8.

9.

10.
Experiment 1
Aim: Code and analyse to compute the greatest common divisor (GCD) of two numbers.

Code:
#include<iostream>
using namespace std;
int gcd(int a, int b){
if (b==0)
return a;
return gcd (b, a%b);
}

int main(){
int a=20, b=30;
cout<<"GCD of "<<a<<" and "<<b<<" is "<<gcd(a,b);
return 0;
}

Output:

You might also like