You are on page 1of 3

Name: Anubhav Mishra Roll Number:18ETCS002017

Laboratory 1
1. Questions

1. Write a program to input two integer numbers and display the sum of even numbers
between these two input numbers.
2. Write a program to find GCD (greatest common divisor or HCF) and LCM (least
common multiple) of two numbers.
3. Write a program to display Fibonacci series up to given limit.
2. Introduction

3. Algorithm

1.

1. Take input for two integers x ,y;


2. Then compare x and y.
3. Then whichever the number is big, check if it is even or odd, if odd then subtract 1
and if even leave it, similarly for the smaller number.
4. At last add up the new values of x and y.

2.

1. Take input for three integers n1, n2 ,and set i=1;


2. Using “for loop” we will divide n1 and n2.
3. If both number are divisible then i will equal to gcd.
4. For LCM we will use (n1*n2)/gcd).

3.

1. Take input for value n as a limit and set x=0 and y=1, i=1 and next term as undefined.
2. Using “for loop” in which i will be increasing till limit.
3. Then use , printf("%d",x); next=x+y; x=y; y=next;
Name: Anubhav Mishra Roll Number:18ETCS002017

4. Program

Figure 1 shows program1

Figure 2 shows the program for finding HCF and LCM


Name: Anubhav Mishra Roll Number:18ETCS002017

Figure 3 shows program for Fibonacci series

5. Presentation of Results

Figure 4 shows output for program1.

Figure 5 shows output for HCF and LCM program

Figure 6 shows output for Fibonacci series

You might also like