0% found this document useful (0 votes)
132 views24 pages

ICT Practical Notebook EV 2025 3 1 1 1

Uploaded by

saadmaanyeaseer
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)
132 views24 pages

ICT Practical Notebook EV 2025 3 1 1 1

Uploaded by

saadmaanyeaseer
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/ 24

INDEX

Ex.No Labwork Date Name of Experiment Page No


01 Webpage Design
1 Creating a webpage using HTML
2 Usage of HTML formatting tag in a
webpage
3 Setting Font color, Size and Face
using HTML tag.
4 Using SUB and SUP Tag in a
webpage
5 Showing image in webpage using
HTML
6 Using List Tag in a webpage
7 Creating a table in HTML
8 Setup links among one to another
websites
02 C Programming Language
1 A program to calculate area of triangle
using base and height
2 A program to calculate area of circle.
3 A program to determine a number is
odd or even
4 A program to calculate the summation
of 1 to N
5 A program to determine factorial of a
+ve number
6 A program to determine the largest
number among three integer number
7 A program to find a GCD of two +ve
number
8 A program to determine a number is
prime or not
Experiment No : 01
Experiment Name : Creating a webpage using HTML

Theory :
The language used to design a webpage is HTML. The Text editors that are usually used
to create HTML document is Notepad++. Before creating a webpage we must decide
how the design would be and what would be the information.

Necessary Tools :
Hardware : A complete desktop or Laptop Computer
Software : Operating system-windows 10 and Editing software- Notepad++
Browsing software : Google chrome or Mozilla Firefox.
Primary works of the experiment :
1. To turn on the main electric lines .
2. To turn on the power switch of CPU.
3. To ensure Notepad++ program is installed

Follow the procedure:


1. Turn on the computer and come to the desktop.
2. Double click on the Notepad ++ icon from the desktop.
3. The Notepad ++ editor will be launched.
4. The necessary tags for creating webpages are typed in Notepad ++.

Preservation of file or webpage :


1. Click on the save icon from the toolbar.
2. From the Save As dialog box, type webpage1.html in the File Name section and
click on the Save button, the created webpage will be saved as webpage1.
Explanation of tags used to create webpages:
<html>.............</html> indicates a HTML document
<head>.............</head> indicates a head part of webpage.
<title>.............</title> used to give a title to webpage
<body>.............</body> indicates main part of webpage.
Display results:
1. Let's click on the launch in Google Chrome or Mozila Firefox browser from
the run option in the Notepad ++ editor.
2. The Google Chrome or Mozila Firefox browser is launched and the part typed
on the body is displayed on the webpage.
3. If the above tasks are done using Notepad ++, a wepage ( webpage1.html) will
be created.

Experiment No : 02
Experiment Name : Usage of HTML formatting tag in a webpage

Theory: Different formatting tags are used to render webpage texts nicely. Using
formatting tags, text can be presented in Bold, Underline, Italic, etc.

Necessary Tools :
Hardware : A complete desktop or Laptop Computer
Software : Operating system-windows 10 and Editing software- Notepad++
Browsing software : Google chrome or Mozilla Firefox.

Primary works of the experiment :


1. To turn on the main electric lines .
2. To turn on the power switch of CPU.
3. To ensure Notepad++ program is installed

Follow the procedure:


1. Turn on the computer and come to the desktop.
2. Double click on the Notepad ++ icon from the desktop.
3. The Notepad ++ editor will be launched.
4. The tags required for formatting the text on the webpage are typed in Notepad ++

<html>
<body>
<b> This is bold </b> <br>
<i> This is Italic </i> <br>
<u> This is underline </u>
</body>
</html>

Preservation of file or webpage :


1. Click on the save icon from the toolbar.
2. From the Save As dialog box, type webpage2.html in the File Name section and
click on the Save button, the created webpage will be saved as webpage2.
Explanation of tags used to create webpages:
<b>..</b> The <b> tag is used to express text in bold.

<u>..</u> The <u> tag is used to express text in underline form.

<i>..</i> The <i> tag is used to express text in italic form.

<del>..</del> Drag a dot in the middle of a text to indicate that it has been deleted
Tags are used.
<br> <br> Tag to break any part in the middle of the line to the next line Is
used. <br> a single tag.
<hr> The <hr> tag is used to draw horizontal lines.

Display results:
1. Let's click on the lunch in Google Chrome or Mozila Firefox browser from
the run option in the Notepad ++ editor.
2. The Google Chrome or Mozila Firefox browser is launched and the part typed
on the body is displayed on the webpage. The text on the webpage is displayed in
bold, italic, underline formats.
3. If the above tasks are done using Notepad ++, a wepage ( webpage2.html) will
be created.

Experiment No : 03
Experiment Name : Setting Font color, Size and Face using HTML tag.

Theory: Different types of fonts, font colors and font sizes need to be used to
present webpage texts beautifully.

Necessary Tools :
Hardware : A complete desktop or Laptop Computer
Software : Operating system-windows 10 and Editing software- Notepad++
Browsing software : Google chrome or Mozilla Firefox.

Primary works of the experiment :


1. To turn on the main electric lines .
2. To turn on the power switch of CPU.
3. To ensure Notepad++ program is installed

Follow the procedure:


1. Turn on the computer and come to the desktop.
2. Double click on the Notepad ++ icon from the desktop.
3. The Notepad ++ editor will be launched.
4. To determine the font color, size, face of the text on the webpage, type the necessary
tags in Notepad ++.

Preservation of file or webpage :


1. Click on the save icon from the toolbar.
2. From the Save As dialog box, type webpage3.html in the File Name section and
click on the Save button, the created webpage will be saved as webpage3.

Explanation of tags used to create webpages:


<font color>..........</font> indicates colour of text
<font size>..........</font> indicates size of text
<font face>..........</font> indicates font style of text

Display results:
1. Let's click on the lunch in Google Chrome or Mozila Firefox browser from
the run option in the Notepad ++ editor.
2. The Google Chrome or Mozila Firefox browser is launched and the part typed
on the body is displayed on the webpage.
3. If the above tasks are done using Notepad ++, a wepage ( webpage3.html) to
show font colour, size and style will be created .

Experiment No : 04

Experiment Name : Using SUB and SUP Tag in a webpage.

Theory: Subscribing is the act of publishing something under a text. The <sub> ...
</sub> tag is used to display subscript text.

Superscript is the act of writing something short and above it. The <sup> ...
</sup> tag is used to display superscript text.
Necessary Tools :
Hardware : A complete desktop or Laptop Computer
Software : Operating system-windows 10 and Editing software- Notepad++
Browsing software : Google chrome or Mozilla Firefox.

Primary works of the experiment :


1. To turn on the main electric lines .
2. To turn on the power switch of CPU.
3. To ensure Notepad++ program is installed

Follow the procedure:


1. Turn on the computer and come to the desktop.
2. Double click on the Notepad ++ icon from the desktop.
3. The Notepad ++ editor will be launched.
4. The required tags for displaying subscript and superscript text on the webpage are
typed in Notepad ++.

Preservation of file or webpage :


1. Click on the save icon from the toolbar.
2. From the Save As dialog box, type webpage4.html in the File Name section and
click on the Save button, the created webpage will be saved as webpage4.
Explanation of tags used to create webpages:
<h1>..........</h1> heading tag will show text target
<hr>..........</hr> The <hr> tag is used to draw horizontal lines.
<sub>..........</sub> used to subscript a text
<sup>..........</sup> used to superscript a text
<br>..........</br> <br> Tag to break any part in the middle of the line
to the next line Is used. <br> A single tag.
Display results:
1. Let's click on the lunch in Google Chrome or Mozila Firefox browser from
the run option in the Notepad ++ editor.
2. The Google Chrome or Mozila Firefox browser is launched and the part typed
on the body is displayed on the webpage.
3. If the above tasks are done using Notepad ++, a wepage ( webpage4.html) to
show subscript and superscript.

Experiment No : 05
Experiment Name : Showing image in webpage using HTML

Theory:
Many times different types of images or pictures need to be added to make
the webpage look beautiful. The <img> tag is used to add images. An image
editing software has to be created and saved in a pre-specified format and
size. The image url must be used as a value with the specific attribute of the
tag used for display.
Necessary Tools :
Hardware : A complete desktop or Laptop Computer
Software : Operating system-windows 10 and Editing software- Notepad++
Browsing software : Google chrome or Mozilla Firefox.

Primary works of the experiment :


1. To turn on the main electric lines .
2. To turn on the power switch of CPU.
3. To ensure Notepad++ program is installed

Follow the procedure:


1. Turn on the computer and come to the desktop.
2. Double click on the Notepad ++ icon from the desktop.
3. The Notepad ++ editor will be launched.
4. Type the required tags into Notepad ++ to display images on a web page.
Preservation of file or webpage :
1. Click on the save icon from the toolbar.
2. From the Save As dialog box, type webpage5.html in the File Name section and
click on the Save button, the created webpage will be saved as webpage5.

Explanation of tags used to create webpages:


img src The command is used to find the source of the image.
sagc.jpg the sagc image in .jpg format is indicated for attachment to the
webpage.
height indicates height of image
width indicates width of image
border indicates border of image

Display results:
1. Let's click on the lunch in Google Chrome or Mozila Firefox browser from
the run option in the Notepad ++ editor.
2. The Google Chrome or Mozila Firefox browser is launched and the part typed
on the body is displayed on the webpage.
3. If the above tasks are done using Notepad ++, The sagc.jpg image (height=300,
width=200, border=2) is displayed on the webpage.

Experiment No : 06
Experiment Name : Using List Tag in a webpage

Theory :
Theory: The <li> tag is used to sort any webpage content into a list. The <li> tag is used
within the tags of <ol>, <ul>, <dir> and <menu>. <ol> means order list and <ul> means
unorder list. The sample webpage is shown using the <ol> tag.

Necessary Tools :
Hardware : A complete desktop/Laptop Computer
Software : Operating system-windows 10 and Editing software- Notepad++
Browsing software : Google chrome or Mozilla Firefox.

Primary works of the experiment :


1. To turn on the main electric lines .
2. To turn on the power switch of CPU.
3. To ensure Notepad++ program is installed
Follow the procedure:
1. Turn on the computer and come to the desktop.
2. Double click on the Notepad ++ icon from the desktop.
3. The Notepad ++ editor will be launched.
4. The necessary tags for list on the webpage are typed in Notepad ++.

Preservation of file or webpage :


1. Click on the save icon from the toolbar.
2. From the Save As dialog box, type webpage6.html in the File Name section and
click on the Save button, the created webpage will be saved as webpage6.

Explanation of tags used to create webpages:


<ol>.............</ol> Indicating order list. Of these, the texts are
displayed in the form of lists 1,2,3.
<li>.............</li> Each line will show in the form of a list

Display results:
1. Let's click on the lunch in Google Chrome or Mozila Firefox browser from
the run option in the Notepad ++ editor.
2. The Google Chrome or Mozila Firefox browser is launched and the part typed
on the body is displayed on the webpage.
3. If the above tasks are done using Notepad ++, The articles are displayed on the
webpage in the form of order list.
Experiment No : 07

Experiment Name : Creating a table in HTML

Theory: There is some information on the webpage which becomes more


beautiful and meaningful when presented in the form of a table. Images, texts,
photographs, etc. are used in the data cell of a table.
Necessary Tools :
Hardware : A complete desktop or Laptop Computer
Software : Operating system-windows 10 and Editing software- Notepad++
Browsing software : Google chrome or Mozilla Firefox.

Primary works of the experiment :


1. To turn on the main electric lines .
2. To turn on the power switch of CPU.
3. To ensure Notepad++ program is installed

Follow the procedure:


1. Turn on the computer and come to the desktop.
2. Double click on the Notepad ++ icon from the desktop.
3. The Notepad ++ editor will be launched.
4. The necessary tags for creating tables on the web page are typed in Notepad ++.

Preservation of file or webpage :


1. Click on the save icon from the toolbar.
2. From the Save As dialog box, type webpage7.html in the File Name section and
click on the Save button, the created webpage will be saved as webpage7.
Explanation of tags used to create webpages:
<table border=1>..........</table> Used to make tables and give borders.
<tr>.............</tr> Used to make table rows
<th>.............</th> Table Headings-used for heading at the top of each
column in the table
<td>.............</td> Used to give data in tables.

Display results:
1. Let's click on the lunch in Google Chrome or Mozila Firefox browser from
the run option in the Notepad ++ editor.
2. The Google Chrome or Mozila Firefox browser is launched and the part typed
on the body is displayed on the webpage.
3. If the above tasks are done using Notepad ++, A table with two columns and
two rows is displayed on the webpage7

Experiment No : 08
Experiment Name : Setup links among one to another websites

Theory: A website is a combination of different pages. To facilitate the work, you


need to harperlink one page with another or more pages or different websites. The
anchor <a> tag is used to hyperlink..

Necessary Tools :
Hardware : A complete desktop or Laptop Computer
Software : Operating system-windows 10 and Editing software- Notepad++
Browsing software : Google chrome or Mozilla Firefox.

Primary works of the experiment :


1. To turn on the main electric lines .
2. To turn on the power switch of CPU.
3. To ensure Notepad++ program is installed

Follow the procedure:


1. Turn on the computer and come to the desktop.
2. Double click on the Notepad ++ icon from the desktop.
3. The Notepad ++ editor will be launched.
4. To create a hyperlink from one webpage to another, type the necessary tags in
Notepad ++.
Preservation of file or webpage :
1. Click on the save icon from the toolbar.
2. From the Save As dialog box, type webpage8.html in the File Name section and
click on the Save button, the created webpage will be saved as webpage8.

Explanation of tags used to create webpages:


<a>.............</a> Anchor tags are used for hyperlinks.
href href means hyper reference attribute
“http://www.google.com” The URL of the google website
(www.google.com) is used as the value of the
attribute. Similarly the URL of that website can be
used for hyperlinks to other websites.

Display results:
1. Let's click on the lunch in Google Chrome or Mozila Firefox browser from
the run option in the Notepad ++ editor.
2. The Google Chrome or Mozila Firefox browser is launched and a list of
webpages will be displayed.
3. If you double click on go to google from the list then google website will open.
Similarly go to Youtube, go to Facebook, go to Twitter by clicking on that
website.
C Programming Language
Experiment No : 01
Experiment Name : A program to calculate area of triangle using base and height

Theory: The height of a triangle is taken to be h, the length of the base to be b and
the area of the triangle to be taken to be A. So area A = ½  b  h. The value of
variables can be whole or decimal numbers. The problem needs to be solved using
C programming language.

Necessary tools:
1. Hardware: A desktop or laptop computer with the following software installed.
2. Software: Operating system windows10
Editing and compiling software Dev C ++

Problem analysis:
Two inputs by analyzing the given problem; The height of the triangle and the
length of the base and the area of the triangle as the output were identified.

Program algorithm:
1. Start
2. Let us take the values of base b and height h.
3. Let us determine the value of area A = ½  b  h.
4. Print the value of A.
5. The end.

Primary works of Experiment :


1. Turn on the computer and wait until the desktop arrives.
2. Let's click on the DevC ++ icon from the desktop.
3. When the DevC ++ editor is started, let's type the following code in a new file.

Program coding:

#include<stdio.h>
#include<conio.h>
main(){
float b, h, area ;
printf("Enter base and height :");
scanf("%f,%f", &b, &h);
area=(b*h)/2;
printf("The area of a triangle : %.2f", area);
getch();
}
Explanation:
1. In this program uses the stdio.h header file for the printf and scanf functions.
2. The conio.h header file is used for the getch function.
3. Since the variables receive decimal numbers, they are declared as float and %f
specifier is used.
4. For %.2f two digits after the decimal will be displayed on the output.

Program Execution:
1. Save the program as exp1.c
2. Let's compile and run by pressing f9 from the keyboard.
3. If any mistakes are identified then correct them and again press f9.
4. After execution, a file named exp1 is automatically created.
Program output:
After executing the program, the following output was seen for the given input.
Enter base and height: 12, 10
Area of a triangle: 60.00

Experiment No : 02
Experiment Name : A program to calculate area of circle.

Theory: Let radius of circle =r and area of circle =A;


So Area of circle A = π  r2;
The value of variables can be whole or decimal numbers. The problem needs to be
solved using C programming language.

Necessary tools:
1. Hardware: A desktop or laptop computer with the following software installed.
2. Software: Operating system windows10
Editing and compiling software Dev C ++

Problem analysis:
By the analyzing of the given problem; The radius of circle as input and area of
circle as the output is identified.

Program algorithm:
1. Start
2. Input radius=r
3. Let us determine the value of area A = π  r2
4. Print the value of A.
5. The end.
Primary works of Experiment :
1. Turn on the computer and wait until the desktop arrives.
2. Let's click on the DevC ++ icon from the desktop.
3. When the DevC ++ editor is started, let's type the following code in a new file.

Program coding:
#include<stdio.h>
#include<conio.h>
#include<math.h>
const float pi=3.1416;
main()
{
float r, area ;
printf("Enter the radius:");
scanf("%f",&r);
area=pi*r *r ;
printf("Area of the circle: %.2f", area);
getch();
}

Explanation:
1. In this program uses the stdio.h header file for the printf and scanf functions.
2. The conio.h header file is used for the getch function.
3. Since the variables receive decimal numbers, they are declared as float and %f
specifier is used.
4. For %.2f two digits after the decimal will be displayed on the output.

Program Execution:
1. Save the program as exp2.c
2. Let's compile and run by pressing f9 from the keyboard.
3. If any mistakes are identified then correct them and again press f9.
4. After execution, a file named exp2 is automatically created.
Program output:
After executing the program, the following output was seen for the given input.
Enter the radius r: 5
Area of the circle: 78.54

Experiment No : 03
Experiment Name : A program to determine a number is odd or even

Theory: Dividing an integer by 2, if the quotient is 0 then the number is even, and
if the quotient is 1 then the number is odd. Hold the number N whose value is an
integer. So dividing N by 2 gives the remainder R which has a value of 0 or 1.
Now the program is written in C language to solve the problem.
Necessary tools:
1. Hardware: A desktop or laptop computer with the following software installed.
2. Software: Operating system windows10
Editing and compiling software Dev C ++

Problem analysis:
Analyzing the given problem, it was identified that a number as input and ‘even’
or ‘odd’ answer can be found as output.
Program algorithm:
1. Start.
2. Input N.
3. Let's find the remainder R by dividing N by 2.
4. If R = 0 then print the number is even, otherwise print odd.
5. The end.

Primary works of Experiment :


1. Turn on the computer and wait until the desktop arrives.
2. Let's click on the DevC ++ icon from the desktop.
3. When the DevC ++ editor is started, let's type the following code in a new file.

Program coding:

#include<stdio.h>
#include<conio.h>
main()
{
int n, r;
printf("Enter a number:");
scanf("%d",&n);
r=r%2;
if(r==0) printf("Even number");
else printf("Odd number");
getch();
}
Explanation:
1. In this program uses the stdio.h header file for the printf and scanf functions.
2. The conio.h header file is used for the getch function.
3. Since variables contain integers, they are declared int and %d specifiers are
used.
4. The % operator has been used to determine the quotient.
Program Execution:
1. Save the program as exp3.c
2. Let's compile and run by pressing f9 from the keyboard.
3. If any mistakes are identified then correct them and again press f9.
4. After execution, a file named exp3 is automatically created.

Program output:
After executing the program, the following output was seen for the given input.
Enter a Number: 5
Odd Number

Experiment No : 04
Experiment Name : A program to calculate the summation of 1 to N

Theory: The sum S is to be found by adding the numbers from 1 to N


periodically. N is an integer. Now to solve the problem we need to write a
program in C language.

Necessary tools:
1. Hardware: A desktop or laptop computer with the following software installed.
2. Software: Operating system windows10
Editing and compiling software Dev C ++

Problem analysis:
Analyzing the given problem, it was identified that a number N can be found as
input and sum as output.

Algorithm:
1. Start.
2. Let's take the value of N.
3. Assume the initial value i = 1 and the sum S = 0.
4. Let's find S = S + i.
5. Let's find i = i + 1.
6. If i <= N then go to step 4.
7. Print the value of S.
8. The end.

Primary works of Experiment :


1. Turn on the computer and wait until the desktop arrives.
2. Let's click on the DevC ++ icon from the desktop.
3. When the DevC ++ editor is started, let's type the following code in a new file.
Program coding:

#include<stdio.h>
#include<conio.h>
main(){
int i , N;
long Sum=0;
printf("Enter the value of N : ");
scanf("%d", &N);
for (i=1;i<=N; i++ )
{ Sum = Sum +i; }
printf("Sum= %ld", Sum);
getch();
}
Explanation:
1. In this program uses the stdio.h header file for the printf and scanf functions.
2. The conio.h header file is used for the getch function.
3. Since variables contain integers, they are declared int and %d specifiers
are used.
4. The sum can be a large integer, so sum is long.
5. The initial value of sum is taken as 0.
6. The value of the variable is increased by 1 by i ++ in the for statement.
The sum is determined by the repeated addition of i to sum. This activity
will continue until the value of i is greater than N here.
Program Execution:
1. Save the program as exp4.c
2. Let's compile and run by pressing f9 from the keyboard.
3. If any mistakes are identified then correct them and again press f9.
4. After execution, a file named exp4 is automatically created.

Program output:
After executing the program, the following output was seen for the given input.
Enter the value of N: 20
Sum = 210

Experiment No : 05
Experiment Name : A program to determine factorial of a +ve number

Theory: The factorial of a number is the product of all integers from 1 to


that number. Hold the number N and its factorial F.
So F=N!=123....N. Now to solve the problem we need to write a
program in C language.
Necessary tools:
1. Hardware: A desktop to laptop computer with the following software installed.
2. Software: Operating system windows10
Editing and compiling software Dev C ++

Problem analysis:
Analyzing the given problem, it was identified that a number N can be found as
input and factorial F as output.

Algorithm:
1. Start.
2. Input the value of N.
3. Assume the initial value i = 1 and the factorial F = 1.
4. Let's find F = F × i.
5. Let's find i = i + 1.
6. If i <= N then go to step 4.
7. Print the value of F.
8. The end.

Primary works of Experiment :


1. Turn on the computer and wait until the desktop arrives.
2. Let's click on the DevC ++ icon from the desktop.
3. When the DevC ++ editor is started, let's type the following code in a new file.

Program coding:

#include<stdio.h>
#include<conio.h>
main()
{
int i , N;
long F=1;
printf("Enter the value if N : ");
scanf("%d", &N);
for (i=1; i<=N; i++ ){
F = F *i; }
printf("factorial is : %ld", F);
getch();
}
Explanation:
1. In this program uses the stdio.h header file for the printf and scanf functions.
2. The conio.h header file is used for the getch function.
3. Since variables contain integers, they are declared int and %d specifiers
are used.
4. The factorial can be a large integer, so F is long.
5. The initial value of F is taken as 1.
6. The value of the variable is increased by 1 by i ++ in the for statement.
The F is determined by the repeated multiplication of i to sum. This
activity will continue until the value of i is greater than N here.
Program Execution:
1. Save the program as exp5.c
2. Let's compile and run by pressing f9 from the keyboard.
3. If any mistakes are identified then correct them and again press f9.
4. After execution, a file named exp5 is automatically created.

Program output:
After executing the program, the following output was seen for the given input.
Enter a positive number: 5
Factorial is: 120

Experiment No : 06
Experiment Name : A program to determine the largest number
among three integer number

Theory: To determine the largest number, hold the three numbers a, b and c
and the big number X. The value of a variable can be a integer or a decimal
number. Now we need to write a program in C language to solve the problem.

Necessary tools:
1. Hardware: A desktop or laptop computer with the following software installed.
2. Software: Operating system windows10
Editing and compiling software Dev C ++

Problem analysis:
Analyzing the given problem, it was identified that there will be three
numbers as input and large number as output.
Program algorithm:
1. Start
2. Input the values of the three numbers a, b, c.
3. Suppose, X = a
4. If the value of b is greater than X, then X = b
5. If the value of c is greater than X, then X = c
6. Print the value of X.
7. The end.
Primary works of Experiment :
1. Turn on the computer and wait until the desktop arrives.
2. Let's click on the DevC ++ icon from the desktop.
3. When the DevC ++ editor is started, let's type the following code in a new file.

Program coding:
#include<stdio.h>
#include<conio.h>
main()
{
float a, b, c, x;
printf("Enter three values:");
scanf("%f, %f, %f", &a, &b, &c);
x=a;
if (b>x) x=b;
if (c>x) x=c;
printf("The largest number: %f", x);
getch();
}
Explanation:
1. In this program uses the stdio.h header file for the printf and scanf functions.
2. The conio.h header file is used for the getch function.
3. Since the variables receive decimal numbers, they are declared as float and %f
specifier is used.
Program Execution:
1. Save the program as exp6.c
2. Let's compile and run by pressing f9 from the keyboard.
3. If any mistakes are identified then correct them and again press f9.
4. After execution, a file named exp6 is automatically created.

Program output:
After executing the program, the following output was seen for the given input.
Enter three values: 10, 12, 9
The largest number: 12

Experiment No : 07
Experiment Name : A program to find a GCD of two +ve number

Theory: One of the two numbers is large and one is small. A program will be
written in C language to diagnose GCD of two numbers .

Necessary tools:
1. Hardware: A desktop or laptop computer with the following software installed.
2. Software: Operating system windows10
Editing and compiling software Dev C ++
Problem analysis:
Analyzing the problem, these two numbers are a large and a small as input and
GCD as the output. It was found to be available.
Program algorithm:
1. Start
2. Take the values of L and S. here L> S
3. Let us determine T = L MOD S.
4. If T = 0 then go to step 7.
5. Otherwise L = S and S = T and go to step 3.
6. Print the value of S.
7. The end.
Primary works of Experiment :
1. Turn on the computer and wait until the desktop arrives.
2. Let's click on the DevC ++ icon from the desktop.
3. When the DevC ++ editor is started, let's type the following code in a new file.

Program coding:
#include<stdio.h>
#include<conio.h>
main(){
int L, S, R;
printf("\nEnter the value of L and S: ");
scanf("%d, %d", &L, &S);
do{
R=L%S
if(R==0) break;
L=S;
S=R;
} while (R!=0);
printf("\n GCD is: %d", S);
getch();
}
Explanation:
1. In this program uses the stdio.h header file for the printf and scanf functions.
2. The conio.h header file is used for the getch function.
3. Since variables contain integers, they are declared int and %d specifiers are used.
4. The loop operation will continue until the value of R in the do statement is 0. The
value of R depends on L and S.
Program Execution:
1. Save the program as exp7.c
2. Let's compile and run by pressing f9 from the keyboard.
3. If any mistakes are identified then correct them and again press f9.
4. After execution, a file named exp7 is automatically created.

Program output:
After executing the program, the following output was seen for the given input.
Enter the Value of L and S: 25, 10
GCD is : 5

Experiment No : 08
Experiment Name : A program to determine a number is prime or not

Theory: To determine whether a number is prime, divide that number by 2 to


N-1 (here N = the number). If the quotient is 0, then the number is not prime.
Otherwise the number will be prime.

Necessary tools:
1. Hardware: A desktop or laptop computer with the following software installed.
2. Software: Operating system windows10
Editing and compiling software Dev C ++

Problem analysis:
By analyzing the given problem, one can know whether a number is prime as input
and prime as output
Program algorithm:
1. Start
2. Input a number N.
3. Let i = 2
4. Let's find R = N MOD i.
5. If R = 0 then print the number not prime and go to step 9.
6. Find i = i + 1.
7. If i <= N-1 then go to step 4.
8. Print whether the number is prime or not.
9. The End

Primary works of Experiment :


1. Turn on the computer and wait until the desktop arrives.
2. Let's click on the DevC ++ icon from the desktop.
3. When the DevC ++ editor is started, let's type the following code in a new file.
Program coding:
#include<stdio.h>
#include<conio.h>
main()
{
int i, n, r, flag;
printf("Enter a number:");
scanf("%d",&n);
for(i=2; i<=n-1; i++)
{
r=n%i
if(r==0) break;
}
if(r==0) printf("The number is not prime");
else printf("The number is prime");
getch();
}

Explanation:
1 In this program uses the stdio.h header file for the printf
and scanf functions.
2. The conio.h header file is used for the getch function.
3. Since variables contain integers, they are declared int and %d specifiers are
used.
4. The % operator has been used to determine the quotient.

Program Execution:
1. Save the program as exp8.c
2. Let's compile and run by pressing f9 from the keyboard.
3. If any mistakes are identified then correct them and again press f9.
4. After execution, a file named exp8 is automatically created.

Program output:
After executing the program, the following output was seen for the given input.
Enter a Number: 29
The Number is Prime

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy