Escolar Documentos
Profissional Documentos
Cultura Documentos
EX.NO : 1.a
CREATING ADVERTISEMENT
DATE :
AIM:
To prepare an advertisement for a company with the following specifications.
ALGORITHM:
Step 1: Open a new document by clicking Start All Programs Microsoft Office
Microsoft Office Word 2007.
Step 2: Go to Page LayoutPage BordersSelect Attractive Page BorderOk.
Step 3: Go to InsertClip ArtSelect Attractive Clip ArtOk.
Step 4: Type a name and selectgo to InsertWord ArtSelect a Word Art & click.
Step 5: Type a brief company details & Right ClickSelect the Bullets Ok.
Step 6: Save the document.
OUTPUT:
RESULT:
CURRICULUM VITAE
DATE :
AIM:
To create curriculum vitae (CV) of a B.E graduate with the specification.
Table to show qualifications with heading.
Left & Right margins
Page numbers in the footer on the right side.
Use Watermark.
ALGORITHM:
Step 1: Open a new document by clicking Start All Programs Microsoft Office
Microsoft Office Word 2007.
Step 2: Type a Bio-data briefly then go to Insert Table Select number of rows &
columnsOk for qualifications.
Step 3: Go to Page LayoutMarginsAssignLeft and Right Margins
Step 4: Go to Insert Page NumbersSelect footer on the right sideOk.
Step 5: Go to Page LayoutWatermarkCustomize text as Bio-dataOk.
Step 6: Save the Document.
OUTPUT:
RESULT:
DATE :
AIM
To search and replace the data using MS - Word.
ALGORITHM:
Step 1: Start the process.
Step 2: Open a new document by clicking Start All Programs Microsoft Office
Microsoft Office Word 2007.
Step 3: To open a document, click file menu in the menu bar and select new. A new page
will appear.
Step 4: Type a paragraph of text in the new opened document.
Step 5: To find a repeated words press Ctrl + F and type the word in the find what text box.
Step 6: Click Find next button to search the full document.
Step 7: To replace the word press Ctrl + H and enter the word to replace the data in replace
with text box.
Step 8: Click replace all button to replace the all word in the full document.
OUTPUT:
1. FIND
RESULT:
SCIENTIFIC NOTATIONS
DATE :
AIM:
To create a MS-WORD document for the following scientific notation
A=
+
+
+
+7
+6
ALGORITHM:
Step 1: Open a new document by clicking Start All Programs Microsoft Office
Microsoft Office Word 2007.
Step 2: Go to InsertEquationSelect the specific format.
For eg,
for
Step 3: Select
..
for
OUTPUT:
RESULT:
DATE :
AIM:
To prepare a class timetable using Merge rows, Split row, Insert rows, columns and
convert the table into text format in spreadsheet.
ALGORITHM:
Step 1: Open a new document by clicking Start All Programs Microsoft Office
Microsoft Office Word 2007.
Step 2: Go to Insert Menu Table Select Number of rows & columnsOk.
Step 3: Select two cells from the table then, Right click Merge Cells.
Step 4: Select one cell from the table Right clickSplit Cell.
Step 5: To insert a row, select a cell and Right click Insert Insert One row above or
below.
Step 6: To insert a column, select a cell and Right click Insert Insert One column left or
right.
Step 7: Type a Class Timetable with Headings.
Step 8: Go to Layout Convert to text Select Tabs Ok.
Step 9: Save the document as Table and Text Format.
OUTPUT:
RESULT:
10
EX.NO : 1.f
DATE :
AIM:
To create a WORD document to call letters for an interview using Mail Merge & send
to 10 candidates.
ALGORITHM:
Step 1: Open a new document by clicking Start All Programs Microsoft Office
Microsoft Office Word 2007.
Step 2: Go to Mailings Menu Start Mail merge Letters.
Step 3: Type an interview call letter with FROM address and leave some Space for TO
address.
Step 4: Go to Mailings MenuSelect recipients Type a new list Customize the
Columns Ok.
Step 5: Type a 10 address new some fieldsOkSave.
Step 6: Go to Mailings Menu Select recipients Use Existing list open a file Ok.
Step 7: Under the TO Address insert the Merge fields & preview the results.
Step 8: Go to Finish MergeEdit individual Documents All Ok.
Step 9: Save the document.
11
12
RESULT:
13
DATE :
AIM:
To create a flowchart in WORD to find the greatest among three numbers
ALGORITHM:
Step 1: Open a new document by clicking Start All Programs Microsoft Office
Microsoft Office Word 2007.
Step 2: Construct a Flowchart for a given program.
Step 3: To draw the flowchart, click Insert Shapes.
Step 4: Click on the required shape.
Step 5: Select the location to draw the shape and then click and drag.
Step 6: To add text within the shape place the cursor over the shape and Right click to add the
text.
Step 7: Use decision symbols for checking the conditions.
Step 8: Use the arrow symbols to represent the flow of control.
Step 9: Stop the process.
14
OUTPUT:
RESULT:
15
DATE :
AIM:
To create a spreadsheet to calculate HRA , DA, TA, PF, LIC, Gross Salary , Net
Salary from the given data.
HRA=18% of basic Pay
LIC =7% of Basic Pay
Deduction= PF + LIC
PF =10% of Basic Pay
DA=15% of Basic Pay
TA=12% of Basic Pay
Gross Salary = Basic Pay + HRA + DA + TA
Net Salary = Gross Salary Deduction
ALGORITHM:
Step 1: Open a new worksheet by clicking Start All Programs Microsoft Office
Microsoft Office Excel 2007.
Step 2: Type the details about the employees and Basic Salary.
Step 3: For HRA, move to corresponding row & column and assign the Formula =18/100* BS
(row & column).
Step 4: For DA, move to corresponding row & column and assign Formula =15/100*BS (row
& column).
Step 5: For TA, move to corresponding row & column and assign the Formula=12/100* BS
(row & column).
Step 6: For PF, move to corresponding row & column. And assign the Formula =10/100* BS
(row & column).
Step 7: For LIC, move to corresponding row & column and assign the formula =7/100* BS,
Step 8: For GS, move to corresponding row & column and assign the
Formula = Basic Pay + HRA + DA + TA.
Step 9: To calculate the Deduction assign the formula = PF + LIC
Step 10: For calculating Net Salary assign the formula = Gross Salary Deduction.
Step 11: Save the ExcelSheet.
16
OUTPUT:
RESULT:
17
DATE :
AIM:
To create a spreadsheet for inserting a Picture, object and to apply the option of
protecting the document.
ALGORITHM:
Step 1: Open a new worksheet by clicking Start All Programs Microsoft Office
Microsoft Office Excel 2007.
Step 2: Go to Insert Select the Picture Insert and type some Text.
Step 3: Go to Review Protect Sheet Set a Password & Re-enter the Password.
Step 4: For Unprotect again go to Review UnProtect Sheet Type Password.
Step 5: Modify the Worksheet and protect it.
Step 6: Save the ExcelSheet.
18
RESULT:
19
DATE :
AIM:
To create a spreadsheet to sort the names and sort the numbers and convert the numbers
Decimal numbers: 243, 46, 173, 425, 625.
Binary numbers:-11011, 1110110101, 11001, 11111.
ALGORITHM:
Step 1: Open a Microsoft Excel Worksheet.
Step 2: Type some list of names in randomly.
Step 3: Select the names and Right click Sort Select the names and sort. In Ascending
Order (A to Z).
Step 4: Select the numbers and Right click Sort Select the numbers and sort. In
Ascending Order (Small to Large).
Step 5: For Conversion go to Formula Select More Functions Engineering Select
DEC2BIN, DEC2HEX, DEC2OCT and BIN2DEC, BIN2HEX, BIN2OCT etc.
Step 6: Save the ExcelSheet.
Step 7: Open MSACCESS Create a database name Save Table design Insert record
save the table.
Step 8: Open a Microsoft Excel Worksheet From access Select Database name Select
the option in import data OK.
Step 9: Open the database Right-click and select EXPORT options Save file OK.
20
OUTPUT:
21
RESULT:
22
EX.NO : 2
DATE :
AIM:
To create graphs and charts with 2D and 3D effects in MS PowerPoint.
ALGORITHM:
GENERATING CHARTS WITH 2D AND 3D EFFECTS
Step 1: Start the Process.
Step 2: Open a document by clicking Start All Programs Microsoft Office
Microsoft Office PowerPoint 2007.
Step 3: To open a new document, click file menu in the menu bar and select new. A new page
will appear.
Step 4: Go to Insert Chart.
Step 5: Choose a template from the displayed types.
Step 6: Enter the data in the corresponding Spreadsheet appeared.
Step 7: A new Chart (2D chart) will be appeared in the slide created.
Step 8: Choose the chart and Click Layout3D rotation from the menu bar for 3D effects.
Step 9: Give the values for x and y axis. Click Reset button.
Step 10: To save the corresponding slide click file and click save.
GENERATING GRAPHS WITH 2D AND 3D EFFECTS
Step 1: Start the Process.
Step 2: Open a document by clicking Start All Programs Microsoft Office
Microsoft Office PowerPoint 2007.
Step 3: To open a new document, click file menu in the menu bar and select new. A new page
will appear.
Step 4: Go to Insert Chart.
Step 5: Select XY SCATTER from the types available.
Step 6: Enter the data in the corresponding Spreadsheet appeared.
Step 7: A new graph will be appeared in the slide created.
Step 8: Choose the chart and Click Layout3D rotation from the menu bar
Step 9: To save the corresponding slide click file and click save.
23
OUTPUT:
24
OUTPUT:
25
OUTPUT:
RESULT:
26
EX.NO : 3
DATE :
AIM:
To construct the algorithm, Pseudocode and flowchart for the given program in MS
word.
ALGORITHM:
Step 1: Start the process.
Step 2: Open a new document by clicking Start All Programs Microsoft Office
Microsoft Office Word 2007.
Step 3: Construct Algorithm, Pseudocode and Flowchart for a given program.
Step 4: To draw the flowchart, click Insert Shapes.
Step 5: Click on the required shape.
Step 6: Select the location to draw the shape and then click and drag.
Step 7: To add text within the shape place the cursor over the shape and Right click to add the
text.
Step 8: Use decision symbols for checking the conditions.
Step 9: Use the arrow symbols to represent the flow of control.
Step 10: Stop the process.
BIGGEST OF THREE NUMBERS
ALGORITHM:
Step
Step
Step
Step
Step
Step
Step
Step
PSEUDOCODE:
START
READ x, y, z as integer
IF x is greater than y and z THEN.
PRINT x
IF y is greater than z THEN
PRINT y
ELSE
PRINT z
27
28
PSEUDOCODE:
START
READ roll no as integer
READ name as character
READ marks as integer
CALCULATE total = mark1 + mark2 + mark3
CALCULATE average = total / 3.
PRINT roll no
PRINT name
PRINT total
PRINT average
FLOWCHART:
RESULT:
29
DATE :
AIM:
To write a C program to find an area and circumference of circle.
ALGORITHM:
Step 1: Start the Program.
Step 2: Input the radius of the Circle.
Step 3: Find the area and circumference of the circle using the formula
area =3.14*r*r
circum=2*3.14*r
Step 4: Print the area and circumference.
Step 5: Stop the Program.
PROGRAM:
//AREA AND CIRCUMFERENCE OF CIRCLE
#include<stdio.h>
#include<conio.h>
void main()
{
float r,area,circum;
clrscr();
printf("\n Enter the radius of the Circle");
scanf("%f",&r);
area=3.14*r*r;
circum=2*3.14*r;
printf("\n Area=%f",area);
printf("\n Circumference=%f",circum);
getch();
}
30
RESULT:
31
DATE :
AIM:
To write a program in C to find the centigrade and Fahrenheit values.
ALGORITHM:
Step
Step
Step
Step
Step
Step
Step
Step
PROGRAM:
// CENTIGRADE AND FARHENHEIT VALUES
#inlcude<stdio.h>
#include<conio.h>
void main()
{
float c, f, cv, fv;
clrscr();
printf(\n Enter the temperature in Centigrade:);
scanf(%f,&c);
f=1.8*c+32;
printf(\n Fahrenheit Equivalent is:% .3f\n,f);
printf(\n Enter the temperature in Fahrenheit:);
scanf(%f,&fv);
cv = (fv 32)/1.8;
printf(\n Centigrade equivalent is:%.3f\n,cv);
getch();
}
32
OUTPUT:
RESULT:
33
EX.NO : 4.c
LEAP YEAR
DATE :
AIM:
To write a C program to find the given year is a leap year or not.
ALGORITHM:
Step 1: Start the program.
Step 2: Read the given year.
Step 3: Check the condition whether it is true or not.
Step 4: If the condition is true, print the year is leap.
Step 5: Else, Print the year is not a leap year.
Step 6: Stop the program.
PROGRAM:
//LEAP YEAR
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int year;
clrscr();
printf(\n Enter the year:);
scanf(%d, &year);
if((year%4==0)&&(year%100!=0)||(year%400==0))
{
printf(\n The year %d is a leap year, year);
}
else
{
printf(\n The year %d is not a leap year, year);
}
getch();
}
34
OUTPUT:
RESULT:
35
EX.NO : 4.d
QUADRATIC EQUATION
DATE :
AIM:
To a write a program in C is to find the roots of the quadratic equation and to evaluate the
expression.
ALGORITHM:
Step 1: Start the Program.
Step 2: Read the variables a, b, c, d, x1, x2.
Step 3: Compute the quadratic equation d = b * b 4 * a * c.
Step 4: Check the condition whether d value is equal to zero.
Step 5: If the condition becomes true, print both roots are equal.
5.1 - Perform the operation x1 = - b / (2.0 * a).
5.2 - Swap the value of x1 to x2.
5.3 - Print the value of x1 and x2.
Step 6: If the condition becomes false, print both roots are real and difference.
6.1 - Perform the operation of x1 = (-b+sqrt(d))/(2*a);
x2 = (-b-sqrt(d))/(2*a);.
6.2 - Print the value of x1 and x2.
Step 7: If both the condition becomes false, print the roots are imaginary.
Step 8: Stop the Program.
PROGRAM:
// QUADRATIC EQUATION
#include <stdio.h>
#include <conio.h>
#include<math.h>
void main()
{
int a,b,c,d;
float x1,x2;
clrscr();
printf("enter the value of a,b & c\n");
scanf("%d%d%d",&a,&b,&c);
d=b*b-4*a*c;
if(d==0)
{
printf("Both roots are equal\n");
x1=-b/(2.0*a);
x2=x1;
printf("First Root x1= %f\n",x1);
printf("Second Root x2= %f\n",x2);
}
2014 2015/ I YEAR/ I SEMESTER/ GE6161 COMPUTER PRACTICES
36
RESULT:
37
EX.NO : 4.e
ARITHMETIC OPERATIONS
DATE :
AIM:
To a write a C program to evaluate the arithmetic operation.
ALGORITHM:
Step
Step
Step
Step
Step
Step
Step
Step
Step
Step
PROGRAM:
//ARITHMETIC OPERATIONS
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c,n;
clrscr();
printf(\n Arithmetic Operation);
printf(\n ~~~~~~);
printf(\n MENU);
printf(\n 1-Addition);
printf(\n 2-Subtraction);
printf(\n 3-Multiplication);
printf(\n 4-Division);
printf(\n 5-Exit(0));
printf("Enter First Number:");
scanf("%d", &a);
printf("Enter Second Number:");
scanf("%d", &b);
printf("choose the arithmetic option\n");
scanf("%d",&n);
switch(n)
{
case 1: c=a+b;
38
RESULT:
39
EX.NO : 5.a
PRIME NUMBERS
DATE :
AIM:
To write a c program to find the first 100 prime numbers.
ALGORITHM:
Step
Step
Step
Step
Step
Step
Step
Step
Step
1:
2:
3:
4:
5:
6:
7:
8:
9:
PROGRAM:
//PRIME NUMBERS
#include<stdio.h>
#include<conio.h>
void main()
{
int n=2, count=0;
int i, m;
clrscr();
printf("\n Enter the number upto which you want to find prime numbers : ");
scanf("%d",&m);
printf("\n Prime numbers are : ");
while(n<m)
{
for(i=2; i<n; i++)
{
if(n%i==0)
goto t;
}
printf("\t%d ", n);
count++;
t : n++;
}
printf("\n\n Number of prime numbers are %d", count);
getch();
}
2014 2015/ I YEAR/ I SEMESTER/ GE6161 COMPUTER PRACTICES
40
OUTPUT:
RESULT:
41
EX.NO : 5.b
FIBONACCI SERIES
DATE :
AIM:
To write a C program to generate the Fibonacci series.
ALGORITHM:
Step 1: Start the program.
Step 2: Read the input value as a=0 and b=1.
Step 3: Determine the condition (i <= n) is true or not.
Step 4: If the condition is true, just add the two variables.
Step 5: Assign the value of b to a and the value of c to b.
Step 6: Every increment in the loop prints the value of c.
Step 7: After the execution of the loop stops the program.
PROGRAM:
#include<stdio.h>
#include<conio.h>
void main()
{
int a, b, c=0,i,n;
clrscr();
a=0;
b=1;
printf(\n ENTER THE RANGE OF SERIES:);
scanf(%d, &n);
printf(\n The Fibonacci series are);
for(i=1;i<=n;i++)
{
printf(\n %d, c);
a=b;
b=c;
c=a+b;
}
getch();
}
42
OUTPUT:
RESULT:
43
EX.NO : 5.c
DATE :
AIM:
To write a C program to generate numbers between 1 and 100 which are divisible by 2
and not divisible by 3 and 5.
ALGORITHM:
Step 1: Start the program.
Step 2: Declare and read the variable n.
Step 3: Determine the condition (n<= 100) is true or not.
Step 4: If the condition is true, further check the given number is divisible by 2 and not
divisible by 3 and 5.
Step 5: If true, print the numbers and increment the n value.
Step 6: If the condition is false, skip the if loop and increment the n value.
Step 6: If the for condition fails, skip the loop.
Step 7: Stop the program.
PROGRAM:
// NUMBERS DIVISIBLE BY TWO
#include<stdio.h>
#include<conio.h>
void main()
{
int n;
clrscr();
printf("\n Display numbers between 1 and 100");
printf("\n");
printf("\n The number divisble by 2 and not divisble by 3 and 5");
for(n=1;n<=100;n++)
{
if((n%2==0)&&(n%3!=0)&&(n%5!=0))
{
printf("\n %d",n);
}
}
getch();
}
44
OUTPUT:
RESULT:
45
EX.NO : 5.d
DATE :
AIM:
To write a C program to convert binary code to gray code conversion.
ALGORITHM:
Step 1: Start the program.
Step 2: Read the variable bin and check the condition whether it is not equal to zero.
Step 3: The Most Significant Bit of the gray code will be exactly equal to the first bit of the given
binary number.
Step 4: The second bit of the code will be exclusive-or of the first and second bit of the given
binary number.
Step 5: The third bit of gray code will be equal to the exclusive-or of the second and third bit of the
given binary number.
Step 6: Display the gray code value.
Step 7: Stop the program.
PROGRAM:
// BINARY TO GRAY CODE CONVERSION
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int bin,gray=0;
int a,b,i=0;
clrscr();
printf("Enter a binary number: ");
scanf("%d",&bin);
while(bin!=0)
{
a=bin%10;
bin=bin/10;
b=bin% 10;
if((a&&!b)||(!a&&b))
{
gray=gray+pow(10,i);
}
i++;
}
printf("The gray code is %d\n",gray);
getch();
2014 2015/ I YEAR/ I SEMESTER/ GE6161 COMPUTER PRACTICES
46
OUTPUT:
RESULT:
47
EX.NO : 5.e
DATE :
AIM:
To write a C program to convert gray code to binary code conversion.
ALGORITHM:
Step 1: Start the program.
Step 2: Read the variable n and check the condition whether it is not equal to zero.
Step 3: If the Number is not equal to zero then modulo the number with 10.
Step 4: Store the value in a[i] and using for loop check the condition.
Step 5: If a[i] =1 then check the condition using if loop.
Step 6: Display the result.
Step 7: Stop the program.
PROGRAM:
// GRAY TO BINARY CODE CONVERSION
#include<stdio.h>
#include<conio.h>
void main()
{
int a[10],i=0,c=0,n;
clrscr();
printf("\n Enter the gray code:\t");
scanf("%d",&n);
while(n!=0)
{
a[i]=n%10;
n/=10;
i++;
c++;
}
for(i=c-1;i>=0;i--)
{
if(a[i]==1)
{
if(a[i-1]==1)
a[i-1]=0;
else
a[i-1]=1;
}
}
printf("\n The binary code is \t");
for(i=c-1;i>=0;i--)
{
printf("%d",a[i]);
}
2014 2015/ I YEAR/ I SEMESTER/ GE6161 COMPUTER PRACTICES
48
OUTPUT:
RESULT:
49
EX.NO : 5.f
DATE :
AIM:
To write a C program to convert decimal code to octal code conversion.
ALGORITHM:
Step 1: Start the program.
Step 2: Read the variable num and check the condition whether it is greater than zero.
Step 3: If the number is less than 8 the octal number is the same.
Step 4: If the num > 7 then divide the number with 8, mention the remainder value.
Step 5: Repeat the step 4 with the quotient till that quotient is less than 8.
Step 6: Display the remainder value in reverse order.
Step 7: Stop the program.
PROGRAM:
// DECIMAL TO OCTAL CODE CONVERSION
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int num;
int rem[50],i=0,length=0;
clrscr();
printf("\n Enter the decimal number: ");
scanf("%d",&num);
while(num>0)
{
rem[i]=num%8;
num=num/8;
i++;
length++;
}
printf("\n Octal number : ");
for(i=length-1;i>=0;i--)
printf("%d",rem[i]);
getch();
}
50
OUTPUT:
RESULT:
51
EX.NO : 5.g
DATE :
AIM:
To write a C program to find the sum, reverse of digits and check it is Palindrome or
not.
ALGORITHM:
Step 1: Start the program.
Step 2: Get the value of a, num. Initialize the value of sum as zero and rnum as zero
Step 3: Check the given condition is not equal to zero.
Remnum%10
SumSum+rem
Rnumrnum *10 +rem
Num num/10
Step 4: After the end of the loop print the sum and reverse no of the digit.
Step 5: Find whether the given reverse number is equal then is palindrome or not.
Step 6: Stop the Program.
PROGRAM:
//SUM OF DIGITS, REVERSE, PALINDROME
#include<stdio.h>
#include<conio.h>
void main()
{
int a, num, sum=0, rnum=0, rem;
clrscr();
printf("\n Enter the Number:");
scanf("%d", &num);
a=num;
while(num!=0)
{
rem=num%10;
sum=sum+rem;
rnum=rnum*10+rem;
num=num/10;
}
printf("\n The Sum of Digits %d is = %d \n", a, sum);
printf("\n The Reverse %d is = %d \n", a, rnum);
if(a==rnum)
printf("\n The given number is a Palindrome");
else
printf("\n The given number is not a Palindrome");
2014 2015/ I YEAR/ I SEMESTER/ GE6161 COMPUTER PRACTICES
52
OUTPUT:
RESULT:
53
.
EX.NO : 5.h
ARMSTRONG NUMBER
DATE :
AIM:
To write a C program for finding an Armstrong Number.
ALGORITHM:
Step 1: Start the program.
Step 2: Read the value of n and set a = n, sum = 0.
Step 3: Check whether a > 0 or not.
Step 4: If the condition is true then, compute
r = n%10,
sum = sum + r * r * r,
n = n/10.
Step 4: Continue the loop until the condition gets false.
Step 5: If the condition becomes false, check the value of a is equal to the value of c.
Step 6: If true, print the given value as an Armstrong Number.
Step 7: Else, print the given value as not an Armstrong Number.
Step 8: Stop the program
PROGRAM:
//ARMSTRONG NUMBER
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int a, b, c=0, d, e;
clrscr();
printf( \n enter the number: );
scanf(%d, &a);
e = a;
while(e!=0)
{
b = e % 10;
c = c + b * b * b;
e = e / 10;
}
if(a==c)
printf(\n %d is an Armstrong number, a);
else
printf(\n %d is not an Armstrong number, a);
2014 2015/ I YEAR/ I SEMESTER/ GE6161 COMPUTER PRACTICES
54
OUTPUT:
RESULT:
55
EX.NO : 5.i
PASCAL TRIANGLE
DATE :
AIM:
To write a C program to print the Pascal triangle.
ALGORITHM:
Step 1: Start the program.
Step 2: Read the value of num.
Step 3: Initialize the value of i = 1, j = 1 and x = 1.
Step 4: Check the condition i <= num.
Step 5: If true, check the condition j<=i.
Step 6: If the loop is true then, verify whether j =1.
Step 7: If j=1 then print the value of x as 1.
Step 8: Else, compute the given equation: x=(x*(i-j+1)/ (j-1)) and print the value of x.
Step 9: Continue the loop until the condition is true and also increment the value of i and j.
Step 9: Stop the program.
PROGRAM:
//PASCAL TRIANGLE
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,n,c,k,space;
clrscr();
printf("Enter the limit ");
scanf("%d",&n);
printf("\n\n");
space=n;
for(i=0;i<n;i++)
{
c=1;
for(k=space;k>=0;k--)
printf(" ");
space--;
for(j=0;j<=i;j++)
{
printf("%d ",c);
c=(c*(i-j)/(j+1));
}
printf("\n");
}
2014 2015/ I YEAR/ I SEMESTER/ GE6161 COMPUTER PRACTICES
56
OUTPUT:
RESULT:
57
EX.NO : 6.a
DATE :
AIM:
To write a C program to find the largest and smallest number in an array.
ALGORITHM:
Step 1:
Step 2:
Step 3:
Step 4:
Step 5:
PROGRAM:
// LARGEST AND SMALLEST NUMBER IN AN ARRAY
#include<stdio.h>
#include<conio.h>
void main()
{
int n,i,j,a[15],t;
clrscr();
printf("\n enter the array size to find min and max values\n");
scanf("%d",&n);
printf(\n enter the array values \n);
for(i=1;i<=n;i++)
{
scanf("%d",&a[i]);
}
for(i=1;i<=n;i++)
{
for(j=i+1;j<=n;j++)
{
if(a[i]>a[j])
{
t=a[i];
a[i]=a[j];
a[j]=t;
}
}
}
printf("The minimum value is %d\n",a[1]);
printf("The maximum value is %d\n",a[n]);
2014 2015/ I YEAR/ I SEMESTER/ GE6161 COMPUTER PRACTICES
58
OUTPUT:
RESULT:
59
EX.NO : 6.b
TRANSPOSE OF A MATRIX
DATE :
AIM:
To write a C program to print transpose of matrix elements.
ALGORITHM:
Step 1: Start the program.
Step 2: Read m rows and n columns of a matrix.
Step 3: Read the elements of A[i][j] matrix.
Step 4: Assign A[j][i] B[i][j].
Step 5: Print the transpose matrix B[i][j].
Step 6: Stop the program.
PROGRAM:
//TRANSPOSE OF A MATRIX
#include<stdio.h>
#include<conio.h>
void main()
{
int a[10][10],b[10][10],i,j,m,n;
clrscr();
printf("Input row & column of matrix:\n");
scanf("%d%d",&n,&m);
printf("Enter the elements of matrix:\n");
for(i=0;i<n;i++)
for(j=0;j<m;j++)
scanf("%d",&a[i][j]);
for(i=0;i<m;++i)
for(j=0;j<n;++j)
b[i][j]=a[j][i];
printf("Transpose of the matrix is:\n");
for(i=0;i<m;++i)
{
prinf(\n);
for(j=0;j<n;++j)
printf("\t%3d",b[i][j]);
}
getch();
}
60
OUTPUT:
RESULT:
61
EX.NO : 6.c
MATRIX MULTIPLICATION
DATE :
AIM:
To write a C program to perform Matrix Multiplication.
ALGORITHM:
Step 1: Start the program.
Step 2: Enter the m rows and n columns of the A matrix.
Step 3: Enter the p rows and q columns of the B matrix.
Step 4: Enter the elements of the A matrix.
Step 5: Enter the elements of the B matrix.
Step 6: Print the elements of the A matrix in matrix form.
Step 7: Print the elements of the B matrix in matrix form.
Step 8: Multiply the A and B matrix and store the element in the C matrix.
Step 9: Print the resultant matrix.
Step 10: Stop the program.
PROGRAM:
//MATRIX MULTIPLICATION
#include<stdio.h>
#include<conio.h>
#include<process.h>
void main()
{
int a[10][10],b[10][10],c[10][10];
int i,j,m,n,p,q,s;
clrscr();
printf("Input row and column of matrix-A\n");
scanf("%d%d",&m,&n);
printf("Input row and column of matrix-B\n");
scanf("%d%d",&p,&q);
if(n!=p)
{
printf("Matrix cannot be multiplied\n");
getch();
exit(0);
}
printf("Input Matrix A\n");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
2014 2015/ I YEAR/ I SEMESTER/ GE6161 COMPUTER PRACTICES
62
63
OUTPUT:
RESULT:
64
EX.NO : 6.d
DATE :
AIM:
To write a C program for sum of two matrices.
ALGORITHM:
Step 1: Start the program.
Step 2: Read p rows and q columns of matrix A.
Step 3: Read m rows and n columns of matrix B.
Step 4: Check the values of p is equal to m and q is equal to n.
Step 5: Read the matrix A[i][j] and B[i][j].
Step 6: Compute the sum of matrix A[i][j] and B[i][j].
Step 7: Print the matrix C[i][j].
Step 8: Stop the Program.
PROGRAM:
//SUM OF TWO MATRICES
#include <stdio.h>
#include <conio.h>
void main()
{
int a[10][10],b[10][10],c[10][10];
int i,j,m,n,p,q;
clrscr();
printf("enter the row and column of A matrix");
scanf("%d%d",&p,&q);
printf("enter the row and column of B matrix");
scanf("%d%d",&m,&n);
if((n==p)&&(m==q))
{
printf("matrices can be added");
printf("enter the element of A matrices:\n");
for(i=0;i<p;++i)
for(j=0;j<q;++j)
scanf("%d",&a[i][j]);
printf("enter the element of B matrices:\n");
for(i=0;i<n;++i)
for(j=0;j<m;++j)
scanf("%d",&b[i][j]);
65
for(i=0;i<n;++i)
for(j=0;j<m;++j)
c[i][j]=a[i][j]+b[i][j];
printf("sum of A and B matrix:\n");
for(i=0;i<n;++i)
{
for(j=0;j<m;++j)
{
printf("%5d",c[i][j]);
printf("\n");
}
}
getch();
}
else
printf("matrix cannot be added\n");
}
66
OUTPUT:
RESULT:
67
EX.NO : 7.a
STRING CONCATENATION
DATE :
AIM:
To write a program to perform the string Concatenation using C.
ALGORITHM:
Step 1: Start the program.
Step 2: Declare the variables and read the input of str1 and str2 as strings.
Step 3: Concatenate the two strings using for loop.
Step 4: Print the string.
Step 5: Stop the Program.
PROGRAM:
// STRING CONCATENATION
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,k;
char str[10],str1[10],str2[20];
clrscr();
printf("\n Enter the String1:");
gets(str1);
printf("\n Enter the String2:");
gets(str2);
for(i=0,j=0;str1[i]!='\0';i++,j++)
str[j]=str1[i];
for(i=0,k=j;str2[i]!='\0';i++,k++)
str[k]=str2[i];
str[k]='\0';
printf("\n The Concatenated String is %s",str);
getch();
}
68
OUTPUT:
RESULT:
69
EX.NO : 7.b
STRING COMPARISON
DATE :
AIM:
To write a program to perform the string Comparison using C.
ALGORITHM:
Step 1: Start the program.
Step 2: Declare the variables and assign a string to str1 and str2.
Step 3: Compare the two strings using for loop.
Step 4: If the given strings are equal then, print Strings are equal.
Step 5: If the given strings are not equal then, print Strings are not equal.
Step 6: Stop the Program.
PROGRAM:
//STRING COMPARISON
#include<stdio.h>
#include<conio.h>
void main()
{
char str1[10],str2[10],i;
clrscr();
printf("\n Enter the String1:");
gets(str1);
printf("\n Enter the String2:");
gets(str2);
for(i=0;str1[i]!='\0'||str2[i]!='\0';i++)
if(str1[i]!=str2[i])
{
printf("\n Strings are not equal");
break;
}
else
{
printf("\n Strings are equal");
break;
}
getch();
}
70
OUTPUT:
RESULT:
71
EX.NO : 7.c
STRING COPY
DATE :
AIM:
To write a program to perform the string Copy using C.
ALGORITHM:
Step 1: Start the program.
Step 2: Declare the variables.
Step 3: Read input string 1.
Step 4: Copy the strings using for loop.
Step 5: Store the string into string 2.
Step 6: Print the String.
Step 7: Stop the Program.
PROGRAM:
//STRING COPY
#include<stdio.h>
void main()
{
char str1[10],str2[10],i;
clrscr();
printf(" Enter string 1");
gets(str1);
for(i=0;str1[i]!='\0';i++)
str2[i] = str1[i];
str2[i] = '\0';
printf("\n The Input string is %s",str1);
printf("\n The Copied string 2 is %s",str2);
getch();
}
72
OUTPUT:
RESULT:
73
.
EX.NO : 7.d
STRING LENGTH
DATE :
AIM:
To write a program to calculate the string length using C.
ALGORITHM:
Step 1: Start the program.
Step 2: Declare the variables.
Step 3: Read input str.
Step 4: Count the string length using for loop.
Step 5: Print the String length.
Step 6: Stop the program.
PROGRAM:
//STRING LENGTH
#include<stdio.h>
#include<conio.h>
void main()
{
int i,sum=0;
char str[20];
clrscr();
printf("\n Enter the String:");
gets(str);
for(i=0;str[i]!='\0';i++)
sum+=i;
printf("\n The number of characters in the string is %d", i);
getch();
}
74
OUTPUT:
RESULT:
75
EX.NO : 7.e
DATE :
AIM:
To develop a program to count vowels in the given string.
ALGORITHM:
Step 1: Start the program.
Step 2: Read input string.
Step 3: Initialize count=0.
Step 4: If input character is equal to vowel, increment the count value.
Step 5: Move to next character. Go to Step 4.
Step 6: If count = 0 is true, Print there is no vowels in the string.
Step 7: If count = 0 is false, Print the count vowels in the string.
Step 8: Stop the program.
PROGRAM:
//TO COUNT VOWELS IN STRING
#include<stdio.h>
#include<conio.h>
#include<ctype.h>
void main()
{
char str[20],c;
int i,count=0;
clrscr();
printf("\nEnter a string");
gets(str);
for(i=0;str[i]!='\0';i++)
{
c=toupper(str[i]);
if(c=='A'||c=='E'||c=='I'|| c=='O'|| c=='U')
count+=1;
}
if(count==0)
printf("\nThere are no vowels in %s",str);
else
printf("\nThere are %d vowels in %s",count,str);
getch();
}
76
OUTPUT:
RESULT:
77
EX.NO : 7.f
DATE :
AIM:
To write a C program to arrange names in alphabetical order.
ALGORITHM:
Step 1: Start the program.
Step 2: Read the input n.
Step 3: Get the names using for loop and initialize i to 0, ji+1.
Step 4: Compare the names by using strcmp function.
Step 5: Print the names in alphabetical order.
Step 6: Stop the execution.
PROGRAM:
//ARRANGE NAMES IN ALPHABETIC ORDER
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char names[50][20],temp[20];
int n,i,j;
clrscr();
printf("\n how many names?");
scanf("%d", &n);
printf("\n Enter the %d names one by one \n ",n);
for(i=0;i<n;i++)
scanf("%s",names[i]);
for(i=0;i<n-1;i++)
{
for(j=i+1;j<n;j++)
{
if(strcmp(names[i],names[j])>0)
{
strcpy(temp,names[i]);
strcpy(names[i],names[j]);
strcpy(names[j],temp);
}
}
}
printf("\n Names in Alphabetical Order");
for(i=0;i<n;i++)
2014 2015/ I YEAR/ I SEMESTER/ GE6161 COMPUTER PRACTICES
78
RESULT:
79
EX.NO : 8.a
DATE :
AIM:
To develop a program to swap two numbers using call by value.
ALGORITHM:
MAIN PROGRAM
Step
Step
Step
Step
Step
SUBROUTINE
Step 1: Start the sub-routine with two parameters.
Step 2: temp = number1.
Step 3: number1 = number2.
Step 4: number2 = temp.
Step 5: Return from sub-routine.
PROGRAM:
// SWAPPING OF TWO NUMBERS USING CALL BY VALUE
#include<stdio.h>
#include<conio.h>
void swap(int , int);
void main( )
{
int a = 10, b = 20 ;
swap(a,b);
printf ( "\n Berfore swapping a = %d b = %d", a, b ) ;
getch();
}
void swap( int x, int y )
{
int t;
t=x;
x=y;
y=t;
printf ( "\nAfter swapping x = %d y = %d", x, y ) ;
2014 2015/ I YEAR/ I SEMESTER/ GE6161 COMPUTER PRACTICES
80
OUTPUT:
RESULT:
81
EX.NO : 8.b
DATE :
AIM:
To develop a program to swap two numbers using call by reference.
ALGORITHM:
MAIN PROGRAM
Step 1: Start the program.
Step 2: Read the value of the variables a and b.
Step 3: Call the function by reference (by address) to swap two numbers.
Step 4: Print the swapped numbers.
Step 5: Stop the program.
SUBROUTINE
Step 1: Start the sub-routine with two parameters (addresses of the two numbers).
Step 2: Declare the variable temp.
Step 3: Swap the variables by assigning the number1 value temp variable.
Step 4: Assign the value of number2 number1.
Step 5: Assign the value of temp number2.
Step 6: Return from sub-routine.
PROGRAM:
//SWAPPING OF TWO NUMBERS USING CALL BY REFERENCE
#include <stdio.h>
void swap(int*, int*);
int main()
{
int x, y;
clrscr();
printf("Enter the value of x and y\n");
scanf("%d%d",&x,&y);
printf("Before Swapping\nx = %d\ny = %d\n", x, y);
swap(&x, &y);
printf("After Swapping\nx = %d\ny = %d\n", x, y);
return 0;
}
void swap(int *a, int *b)
{
int temp;
temp = *b;
*b = *a;
2014 2015/ I YEAR/ I SEMESTER/ GE6161 COMPUTER PRACTICES
82
RESULT:
83
EX.NO : 8.c
DATE :
AIM:
To write a C program to calculate the mean, variance and standard deviation using
functions.
ALGORITHM:
Step 1: Start the program.
Step 2: Enter the array size.
Step 3: Enter the elements of the array.
Step 4: Print the Entered elements.
Step 5: Call the function to calculate mean.
Step 6: Call the function to calculate variance.
Step 7: Call the function to calculate standard deviation.
Step 8: Call the average function from the standard deviation function.
Step 9: Stop the program.
PROGRAM:
//COMPUTE STANDARD DEVIATION USING FUNCTION
#include<stdio.h>
#include<math.h>
#include<conio.h>
main()
{
int i, num;
float dev, list[100];
float standev();
clrscr();
printf("\n Enter the size of the list");
scanf("%d",&num);
printf("\n Enter the elements of the list");
for(i=0;i<num;i++)
scanf("%f",&list[i]);
printf("\n Entered elements are");
for(i=0;i<num;i++)
printf("\n%f",list[i]);
dev= standev(list,num);
printf("\n Standard Deviation of the list is %10.5f\n",dev);
getch();
}
84
RESULT:
85
EX.NO : 9
DATE :
AIM:
To write a c program to generate the Factorial number using Recursive Function.
ALGORITHM:
MODULE A (MAIN FUNCTION):
Step 1: Start the program.
Step 2: Read the value of n.
Step 3: Pass the integer value of n to module B.
Step 4: Print the value returned by module B as the required factorial.
MODULE B (USER DEFINED FUNCTION)
Step 1: Accept the value from calling module.
Step 2: Check the integer n is equal to 1, if yes return 1 to main function.
Step 3: Else, perform the expression n*fact(n-1) and return the value to main function.
PROGRAM
// FACTORIAL NUMBER USING RECURSIVE FUNCTION
#include<stdio.h>
#include<conio.h>
int fact(int n);
void main()
{
int n;
clrscr();
printf("\nEnter an integer:");
scanf("%d",&n);
printf("\nThe factorial of % is = %d",n,fact(n));
getch();
}
int fact(int n)
{
if(n==1)
return 1;
else
return(n*fact(n-1));
}
2014 2015/ I YEAR/ I SEMESTER/ GE6161 COMPUTER PRACTICES
86
OUTPUT:
RESULT:
.
2014 2015/ I YEAR/ I SEMESTER/ GE6161 COMPUTER PRACTICES
87
EX.NO : 10.a
DATE :
AIM:
To write a C program to print the mark sheet of n students using structures.
ALGORITHM:
Step 1: Start the program.
Step 2: Assign Structure with tag name std.
Step 3: Declare the variables rno, marks as integer, and name[10] as character.
Step 3: Read total number of students n.
Step 4: Read s[i].rno, s[i].name, s[i].marks.
Step 5: Print s[i].rno, s[i].name, s[i].marks.
Step 6: Stop the program.
PROGRAM:
// MARKSHEET OF STUDENTS USING STRUCTURES
#include<stdio.h>
#include<conio.h>
typedef struct std
{
int rno;
char name[10];
int marks;
}student;
student s[10];
void main()
{
int i,n;
clrscr();
printf("Enter total no.of students:");
scanf("%d",&n);
printf("Enter student details:\n");
printf("Enter the RollNo,Name and Mark:\n");
for(i=1;i<=n;i++)
scanf("%d%s%d",&s[i].rno,s[i].name,&s[i].marks);
printf("\n");
printf("student details are \n\n");
printf("Rollno \t Name\t\tMarks\n");
for(i=1;i<=n;i++)
printf("%d\t\t%s\t\t%d\n",s[i].rno,s[i].name,s[i].marks);
getch();
2014 2015/ I YEAR/ I SEMESTER/ GE6161 COMPUTER PRACTICES
88
OUTPUT:
RESULT:
89
EX.NO : 10.b
DATE :
AIM:
To write a C program to print the given employee details using nested structure.
ALGORITHM:
Step 1: Start the program.
Step 2: Assign Structure with a tag name date.
Step 3: Declare the variables day, year as an integer and month as a character.
Step 4: Assign Structure with a tag name employee.
Step 5: Declare the variables code as an integer, name as a character and salary as a float.
Step 6: Nest the structure date within a structure employee.
Step 7: Read the employee details such as emp.code, emp.name, emp.salary.
Step 8: Read the employee joining date using nested structure such as
emp.joining.day, emp.joining.month, emp.joining.year.
Step 9: Print the employee details.
Step 10: Stop the program.
PROGRAM:
//EMPLOYEE PERSONAL DETAILS
#include<stdio.h>
#include<conio.h>
void main()
{
struct date
{
int day;
char month[20];
int year;
};
struct employee
{
int code;
char name[30];
float salary;
struct date joining;
};
struct employee emp;
printf("\n\n");
printf("\n Enter the employee code:");
2014 2015/ I YEAR/ I SEMESTER/ GE6161 COMPUTER PRACTICES
90
OUTPUT:
RESULT:
91
EX.NO : 10.c
DATE :
AIM:
To write a C program to print the record of n students using unions.
ALGORITHM:
Step 1: Start the program.
Step 2: Assign union to student1 student2.
Step 3: Read student1.name, student1.subject, student1.percentage.
Step 4: Read student2.name, student2.subject, student2.percentage.
Step 5: Print student1, student2 records.
Step 6: Stop the program.
PROGRAM:
// STUDENTS RECORD USING UNIONS
#include <stdio.h>
#include <string.h>
union student
{
char name[20];
char subject[20];
float percentage;
};
int main()
{
union student record1;
union student record2;
clrscr();
// assigning values to record1 union variable
printf("Union record1 values example\n");
strcpy(record1.name, "Raju");
printf(" Name
: %s \n", record1.name);
strcpy(record1.subject, "Maths");
printf(" Subject : %s \n", record1.subject);
record1.percentage = 86.50;
printf(" Percentage : %f \n\n", record1.percentage);
// assigning values to record2 union variable
printf("Union record2 values example\n");
strcpy(record2.name, "Mani");
2014 2015/ I YEAR/ I SEMESTER/ GE6161 COMPUTER PRACTICES
92
RESULT:
93