You are on page 1of 16

Program Name and Code:(22412) Academic Year : 2022-2023

Course Name and Code: Java Programming Semester : fourth

ASTUDY ON

DEVELOP A ‘JAVA PROGRAM ON NUMBER GUESSING GAME’

MICRO PROJECT
Submitted by 4 students

Sr. Roll No Enrollment Seat No


Full Name Of Students
No (Sem-III) No (Sem-III)

1 2220 JANHVI VIJAYKUMAR 2117340059 275150


KATAKTHOND

2 2221 KULSOOM FEROZ KAZI 2117340029 27520

3 2242 SADIYA KHURSHID SAYED 2117340034 275125

4 2262 SEJAL MANGESH 2117340232 275178


GHORPADE

Under the Guidance of

PROF.MS.TAMANNA SHAIKH
in

Three Years Diploma in Engineering & Technology of Maharashtra State Board of Technical
Education, Mumbai (Autonomous)

SO 9001:2008 (ISO/IEC-27001:2013)

At

1734 – TRINITY POLYTECHNIC PUNE


MAHARASHTRA STATE BOARD OF
TECHNICAL EDUCATION, MUMBAI

Certificate

This is to certify that Mr. /Ms.

Roll No: of Fourth Semester of Diploma

Programme in Engineering & Technology at 1734 – Trinity Polytechnic Pune, has

completed the Micro Project satisfactorily in Subject ______________in the academic

year 2022-23 as per the MSBTE prescribed curriculum of I Scheme.

Place: Enrollment No:

Date: / /2023 Exam seat No:

Project Guide Head of the Department Principal


Seal of Institute
INDEX

Sr No. Title

1. Introduction

2. Abstract

3. Information

4. Code

5. Conclusion

6. Reference

INTRODUCTION

1.key objective is to introduce the basic concepts of software design. At one-level this is C-
specific: to learn to design, code and debug complete C programs. At another level, it is more
general: to learn the necessary skills to design large and complex software systems. This
involves learning to decompose large problems into manageable systems of modules; to use
modularity and clean interfaces to design for correctness, clarity and flexibility

2.Like arrays, Linked List is a linear data structure. Unlike arrays, linked list elements are not
stored at a contiguous location; the elements are linked using pointers.
Trinity Polytechnic Pune

a)Linked List is a very commonly used linear data structure which consists of group
of nodes in a sequence.

b)Each node holds its own data and the address of the next node hence forming a chain like
structure.

c)Linked Lists are used to create trees and graphs.

3.There are 3 different implementations of Linked List available, they are:


1. Singly Linked List
2. Doubly Linked List
3. Circular Linked List

ii

ABSTRACT

About Project

Here, we created a self-referential structure to implement a linked list, a function to add a


node at the start and end of the list, and a function find First Common() to find the first
common item from two specified linked lists.

In the main() function, we created two linked lists and called the function find First
Common() to find the first common element.

Computer Department
Trinity Polytechnic Pune

1.Applications of linked list in c


1. Implementation of stacks and queues
2. Implementation of graphs : Adjacency list representation of graphs is most popular
3.which is uses linked list to store adjacent vertices.
4. Dynamic memory allocation : We use linked list of free blocks.
5. Maintaining directory of names
6. Performing arithmetic operations on long integers
7. Manipulation of polynomials by storing constants in the node of linked
epresenting sparse matrices

2.Applications of linked list in real world-


8. Image viewer – Previous and next images are linked, hence can be accessed by next
and previous button.
9. Previous and next page in web browser – We can access previous and next url
searched in web browser by pressing back and next button since, they are linked as linked
list.
10. Music Player – Songs in music player are linked to previous and next song. you can
play songs either from starting or ending of the list.

-Hence we have selected this topic and perform program in visual studio code and learn the
process of develop a ‘c’ program to find the first common element between the 2 given linked
lists and perform it successfully

iii
INFORMATION

Linked List
o Linked List can be defined as collection of objects called nodes that are randomly
stored in the memory.
o A node contains two fields i.e. data stored at that particular address and the pointer
which contains the address of the next node in the memory.
o The last node of the list contains pointer to the null.

Computer Department
Trinity Polytechnic Pune

Uses of Linked List


o The list is not required to be contiguously present in the memory. The node can reside
any where in the memory and linked together to make a list. This achieves optimized
utilization of space.
o list size is limited to the memory size and doesn't need to be declared in advance.
o Empty node can not be present in the linked list.
o We can store values of primitive types or objects in the singly linked list.

 You have to start somewhere, so we give the address of the first node a special name
called HEAD. Also, the last node in the linked list can be identified because its next
portion points to NULL.
 Linked lists can be of multiple types: singly, doubly, and circular linked list. In this
article, we will focus on the singly linked list. 

Representation of Linked List


Let's see how each node of the linked list is represented. Each node consists:
11. A data item
12. An address of another node

We wrap both the data item and the next node reference in a struct as:

struct node
{
int data;
struct node *next;
};

Computer Department
Trinity Polytechnic Pune

2
CODE

#include <stdio.h>
#include <stdlib.h>

struct node
{
int num;
struct node *next;

Computer Department
Trinity Polytechnic Pune

};

void create(struct node **);


int find(struct node *, struct node *);
void release(struct node **);
void display(struct node *);

int main()
{
struct node *p = NULL, *q = NULL;
int result;

printf("Enter data to be inserted in the 1 list\n");


create(&p);
printf("Enter data to be inserted in the 2 list\n");
create(&q);
printf("Displaying list1:\n");
display(p);
printf("Displaying list2:\n");
3

display(q);

result = find(p, q);


if (result)
{
printf("The first matched element is %d.\n", result);
}
else
{

Computer Department
Trinity Polytechnic Pune

printf("No matching element found.\n");


}
release (&p);

return 0;
}

int find(struct node *p, struct node *q)


{
struct node *temp;

while (p != NULL)
{
temp = q;
while (temp != NULL)
{
if (temp->num == p->num)
{
return p->num;
}

4
temp = temp->next;
}
p = p->next;
}

return 0;
}

void create(struct node **head)

Computer Department
Trinity Polytechnic Pune

{
int c, ch;
struct node *temp, *rear;

do
{
printf("Enter number: ");
scanf("%d", &c);
temp = (struct node *)malloc(sizeof(struct node));
temp->num = c;
temp->next = NULL;
if (*head == NULL)
{
*head = temp;
}
else
{
rear->next = temp;
}
rear = temp;

5
printf("Do you wish to continue [1/0]: ");
scanf("%d", &ch);
} while (ch != 0);
printf("\n");
}

void display(struct node *head)


{
while (head != NULL)

Computer Department
Trinity Polytechnic Pune

{
printf("%d\t", head->num);
head = head->next;
}
printf("\n");
}

void release(struct node **head)


{
struct node *temp;
while ((*head) != NULL)
{
temp = *head;
(*head) = (*head)->next;
free(temp);
}
}

PROGRAM OUTPUT

Computer Department
Trinity Polytechnic Pune

Computer Department
Trinity Polytechnic Pune

CONCLUSION

 In this article we have created a guessing game in java.

Computer Department
Trinity Polytechnic Pune

 First we generated a number and then ask the user for answer k
times(trials)
 If the guessed number is more than the real number, the program
will display the message "guessed number greater than the
actual number."
 If the guessed number is less than the real number, the program
will display a message indicating that the guessed number is less
than the actual number.
 If the guessed number is the same as the real number, or if all K
trials have been completed, the program will terminate with an
appropriate message.
 To Guess the number we can use a binary search algorithm For
example if the number generated is 25 then we can first check if
the answer is (0+100/2)=50 as it is higher than then answer then
we will move our low to 0 and high to 50 then mid will be 25
which is the answer.

Computer Department
Trinity Polytechnic Pune

9
REFERENCES

https://www.scaler.com/topics/number-guessi

Computer Department
Trinity Polytechnic Pune

10

TEAM W0RK

1. Faisal irfan shaikh roll no= 60


2. Ayaan siraj khan roll no= 23

Computer Department

You might also like