GE2115 Computer Practice Laboratory - I List of Exercises A) Word Processing
GE2115 Computer Practice Laboratory - I List of Exercises A) Word Processing
LIST OF EXERCISES
a) Word Processing
b) Spread Sheet
7. Spread sheet - inclusion of object, Picture and graphics, protecting the document and sheet.
Simple C Programming *
10. Arrays
12. Functions
* For programming exercises Flow chart and pseudo code are essential
No Page
Title No:
10A ARRAYS
Program to add two matrices 45
10B String Length And Concatenation
49
STRUCTURES AND UNIONS
11A Student Detail 51
Student Database
11B
53
FUNCTIONS
12A Recursion Using Function 56
1 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I
Procedure:
Step 1: Open a new document and perform the following tasks:
Open a new document using File New option and type the text.
For justification select the entire text of the document and press Ctrl + J or select the justify
button on the formatting tool bar.
For Bold face of the words, select the word you want to change and press Ctrl + B or select
the bold button on formatting tool bar.
For spelling corrections select the word you want to correct and right click and select auto
correct and select the needed correct word.
Select the text you want to make Italic style then press Ctrl + I click the Italic button on the
formatting tool bar.
Select the text, which you want underline and press CTRL+ U or click on underline button
on formatting tool bar.
For saving the document, press Ctrl +S or click on save button on Standard tool bar or
select the Save option from the File menu. Choose a suitable file name in the File menu.
Then it shows the Save As dialog box. Choose a suitable file name in File Name Text Box,
then click Save button on Save As dialog Box. Now the document is saved under a given
name.
Step 2: Alignment
For Left Alignment press Ctrl + L or press Align Left Button on the formatting toolbar.
For Center Alignment press Ctrl + E or press Center button on the formatting tool bar.
For Right Alignment press Ctrl +R or press Align Right Button on the formatting tool bar.
For Justification press Justify button on the formatting tool bar.
Select the text where you want to add Bullets and Numberings.
Then click Bullets on the Formatting Tool Bar or choose Bullets and Numbering option
from the Format menu. It shows the Bullets and Numbering dialog box.
Choose the required Bullet from the Bullet Tab for Bullets.
Choose Numbering Button on the Formatting tool bar or choose required number series
from the Numbered tab in the Bullets and Numbering dialog box.
Select the paragraphs of the document using the left mouse button or Choose Select All
option from the Edit menu or by pressing Ctrl + A.
2 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I
Choose Paragraph option from the Format menu selection. A paragraph dialog box appears.
Select the 1.5 Lines from the Line Spacing list box, and then click OK.
Now the 1.5 line spacing is applied to the selected paragraph.
Choose Select All option from Edit menu or by pressing Ctrl +A.
Now the total text of the document will be highlighted.
Click Border icon in the Formatting Tool Bar.
Then click outside the text to de-select it. Now you will see the entire text in a box.
Select the text you want to change for Font types and Sizes.
Then choose Font option from the format menu.
It shoes the Font Dialog Box.
Choose the required Font Type from the Font drop down list box and the required Size from
the Size list box on the Font dialog box. Then click Ok.
Type the text, then put the cursor where you want to add the symbol.
Choose Symbols Option from the Insert menu.
Shows the Symbols dialog box. Then choose the appropriate Font type.
Then choose required symbol from the symbols dialog box. Then click Insert.
Step 8: Equations
Type the heading in the document. Then choose the appropriate Font Type and Size.
Put the heading in Center Alignment
Type the required text for adding bullets.
Choose Bullets and Numbering option from the format menu.
Choose Book type bullets from the Webdings font type.
3 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I
5 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I
6 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I
3 Krishna 4000
4 Vinay 3000
Total salary
7 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I
8 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I
Procedure:
Step 1: Drawing Picture
Choose the Up Ribbon option in the Stars and Banners of the Auto Shapes menu in the
Drawing Toolbar.
Draw the required size of Up Ribbon in the document.
Click on the Insert Word Art icon in the drawing tool.
Now the Word Art gallery dialog box is shown with different style.
Choose the required style, and then click Ok.
Now the Edit Word Art Text box dialog is opened.
Type the text then click on Ok.
Place the text then click on OK.
Place the text in the Up Ribbon.
Now the WordArt gallery dialog box is shown with different style.
Choose the required style, and then click ok.
Now the Edit Word Art Text box is shown.
Type the text then click Ok.
Place the WordArt in the appropriate places.
Step 4: Flow Chart
Choose Flowchart option in the Auto shapes menu of the Drawing Toolbar.
Choose the appropriate flowchart symbol, and then drag the symbol in the document.
Type the text in the Symbol, but right click then choose Add Text.
Using the Arrow button Line Style Using the Arrow button Line Style Arrow Style in the
drawing Toolbar draw the lines connecting to the different flowchart symbols.
Select all the flowchart symbols and lines in the document using the Select Objects button,
then right choose Grouping, then click on Group.
Now all the Flowchart symbols are grouped into one.
Procedure:
Step1: Graphs in excel
Enter the data in the Worksheet as follows
Choose Chart option from the Insert menu, or choose the chart wizard button from the
Insert menu, or choose the Chart Wizard button from the Standard toolbar.
It shows the chart Wizard Step 1 of 4 Chart type dialog box.
Choose the appropriate Chart type from the Chart type list box then click next.
12 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I
Shows the Chart Wizard Step 2 of 4 Chart source Data dialog box, then click next.
Shows the Chart Wizard Step 3 of 4 Chart options dialog box, here we can give the Chart
Titles i.e. X and Y-Axis Titles etc then click next.
Shows the Chart Wizard step 3 of 4 Chart Locations dialog box the click Finish.
Now the chart is displayed on the active worksheet.
13 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I
For TA put the cell pointer in E2 and press = (equal to) for entering the formula the choose
the
C2 cell (Basic salary) and type * ( multiplication operator ) and type 15% then press Enter.
Now the 15% TA from BASIC is calculated. Then drag that formula for entire records.
For GS (Gross salary): put the cell pointer in J2 and choose=, then click on C2 cell + click
on D2 + click on E2 + click on F2 and press enter. Now the gross salary is calculated.
Drag the entire cell.
Follow the above steps for DD and NS calculations
After all calculations, select the data in the worksheet, then choose Data->sort from the sort
dialog box, choose name for the sort order.
Step 2: To change font type and size
Choose Format-> cell menu selection, a Format cell dialog box appears, from that dialog box
14 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I
Choose Font tab, then change the required type of font, font style and size.
To insert rows and columns, choose insert->row and insert->column menu selections for row
and column insertion.
For editing data in worksheet, choose the active cell in which you want to edit data, then
double click on it press F2 function key or click on the formula bar.
To add headers and footers option from the view menu.
A page setup dialog box appears, from that choose headers and footers tab. Then type the
header text in header area and footer text in footer area.
Step 3: Conversions
Click Tools->Add ins dialog box
In the Add-ins dialog box, click the checkbox of Analysis toolbar, Analysis toolbar-VBA
Click on A2; enter the decimal number in rows. Click on B2, type=dec2bin (A2), copy the
formula to the remaining, as it converts decimal number to binary.
Click on C2, type=dec2hex (A2), copy the formula to the remaining, as it converts decimal
number to hexadecimal
Click on A15, enter the decimal number in rows type=dec2dec (A15), copy the formula to
the remaining, as it converts decimal number to binary.
Click on C15, type=dec2hex (A15), copy the formula to the remaining, as it converts binary
to hexadecimal
Click on D15, type=dec2oct (A15), copy the formula to the remaining, as it converts binary
to octal system.
Step4: Employee pay
Enter the employee details as shown in the table above
click in cell D2, type =IF(C2<8000,C2*56/100,C2*44/100)
click in cell F2, type =C2*0.1
click in cell G2, type =C2+D2+E2
Click in cell H2 type=G2-F2
copy the formulae to the remaining records
Place the cursor in H8,type=MAX(H2:H4)
The maximum salary will be displayed.) Place the cursor in H9,type=MIN(H2:H4)
The minimum salary will be displayed.
Step5: To find the sum of the marks
Enter the student name, marks in three subjects.
Place the cursor in E2, type=SUM (B2...D3)
Place the cursor in F2, type=AVERAGE (B2...D3)
Click on G2, type
=IF(OR(B2<35,C2<35,D2<35)”FAIL”,IF(F2>=75,”DISTINCTION”,
IF(F2>=60,”FIRSTCLASS”, IF(F2>=50,”SECOND CLASS”,”THIRD CLASS”))))
Copy the formulae to the remaining students
15 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I
Procedure:
There are so many objects that can be inserted into the worksheets.
Choose Objects option in the Insert menu.
Choose Picture option from the Insert Menu.
Choose appropriate object from the Auto shape menu of the Drawing toolbar.
Procedure:
Step 1: Enter the data into Worksheet
Enter the Name, Department, and Salary in different columns.
Click Data-> Form option, it shows the form.
Click New button in the Form to add the rows to the list.
After adding the rows, place the cursor in the list in the worksheet.
Click Data-> Sort; it shows the Sort dialog box.
In the Sort by drop down list select Dept, click Ok.
Again in Sort, Click Salary fro Then By drop down list.
The rows re sorted now, depending on the DEPT and SALARY.
Click Data->Filter->Auto filter, it shows an arrow at each field.
On the Dept click the icon select Accounts.
The list of rows which belongs o Accounts is displayed.
Place the cursor in A15, find the sum using SUM formula.
In the same way find each department’s total salary.
Select Stop from Style, in the Error Message box type. “Number selected is out of
range”.
Click on A11, “Enter Class”.
Click Settings tab select List from Allow drop down list, type FIRST, SECOND, THIRD
in Source.
Click Input Message tab, in the Input Message box type, ”Please Select Class”, then
Click OK
Click on A12 Enter “Amount’.
Click C12,type = IF(C11=”FIRST”, 500 ,IF (C11=”SECOND”,400 ,300))
Step 3: Subtotals
The Subtotals are helpful to analyze the data in the list and quickly create reports and
Charts.
Type the list in a worksheet with column as Salesman, Product, and Sale.
Select all, and then Sort the sales Column to add subtotals.
Click Data->Subtotals
The Subtotal dialog box appears.
Select the column name from each change in drop down list box to add subtotals.
Use the Sum function from the Use function drop down list box.
Select the field names Sales, Product from the Add Subtotals drop down list box.
Click OK to add subtotals and a grand total.
Now the list displays the subtotals and grand total.
Step 4: Creating the Customs Fill Series
If we have already entered the list of items you want to use as a series, select the list on the
worksheet.
On the Tools menu, click Options.
Now the Options dialog box is opened.
Click the Custom Lists tab.
To use the selected list, click Import.
To type a new list, select New list in the Custom lists box and then type the entries in
the List entries box , beginning with the first entry. Press ENTER after each
. When the list is complete, click on Add button.
19 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I
Algorithm:
Flow Chart:
Start
Read radius
Area=3.14 * r *r
circumference= 2 * 3.14 * r
Print
area,circumference
Stop
Source Code:
#include<stdio.h>
#include<conio.h>
Void main()
{
float radius, area, circum;
20 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I
scanf("%f",&radius);
area=3.14*radius*radius;
circum=2*3.14*radius;
printf("\nArea=%f",area);
printf("\nCircumfrerence=%f",circum);
getch();
}
Output:
Enter the radius 4
Area=50.240002
Circumfrerence=25.120001
Algorithm:
21 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I
Flowchart:
Start
Read bnum
Binbnum
Is
bnum=
0
bnum
Digital bnum % 10
Decimaldecimal+(digital< base)
Bnum bnum/10
Print bin,decimal
Stop
Source Code:
#include<stdio.h.
main()
{
int bnum,digit,decimal=0,bin,base=0;
printf(“\nEnter the binary number”);
scanf(“%d”,&bnum);
printf(“%d”,bnum);
bin=bnum;
while(bnum!=0)
{
digit=bnum%10;
22 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I
Output:
Enter the binary number 100
The binary equivalent of 100 in decimal =4
Algorithm:
Step 1: Start the program.
Step 2: Read x and n
Step 3:Convert x values into radian using formula x=x*3.1412/180
Step 4: t x;
Step 5: sum=x;
Step 6: setup for loop i=1 until (i<n+1) increment 1
Step 7:t (t*(pow(double)(-1),(double(2*i-1))*x*x)/(2*i*(2*i+1)
Step 8: t1 (t1*pow((double)(-1),(double)(2*i-1))*x*x)/(2*i*(2*i-1));
Step 9: sum sum+t;
Step 10: print sum
Step 11: stop
23 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I
Flow Chart:
start
Read x,n
x=x*3.1412/180
for i=0;i<n;i++
T=(t*(pow(double)(1),(double
(2*i-1))*x*x)/(2*i*(2*i+1)
T1=(t1*pow((double)(1),(double)
(2*i-1))*x*x)/(2*i*(2*i-1));
Print sum
stop
Source Code:
#include<stdio.h>
#include<conio.h>
24 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I
#include<math.h>
void main()
{
float x, t,sum,t1,sum1;
int i,n;
clrscr();
printf("Enter the value of x,n : ");
scanf("%f%d",&x,&n);
printf("%4.2f %d\n",x,n);
x=x*3.1412/180;
t=x;
sum=x;
t1=x;
sum1=x;
for(i=1;i<n;i++)
{
t=(t*pow((double)(-1),(double)(2*i-1))*x*x)/(2*i*(2*i+1));
sum=sum+t;
}
for(i=1;i<n;i++)
{
t1=(t1*pow((double)(-1),(double)(2*i-1))*x*x)/(2*i*(2*i-1));
sum1=sum1+t1;
}
printf("The value of SINE(%f)=%6.4f\n",x,sum);
printf("the value of COSINE(%f)=%6.4f\n",x,sum1);
getch();
}
Output
Algorithm:
Step1: Start
Step 2: Enter the X and n Value.
Step 3: Set a loop up to n
Step 4: Find the exponent value of x
25 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I
temp= temp* x / i
Sum= sum+ temp
Step 5: After the execution of the loop print the exponent value of x
Step 6: Stop
Flowchart
Start
read x,no
i=1
is Print
i<no Sum
i=i+1
temp=temp * x /i
Stop
Sum = sum + temp
Source Code:
// Exponential Series
#include<stdio.h>
main()
[
float x,temp=1,sum=1;
int i,no;
printf(‘Enter the numbers”);
scanf(“%f%d”,&x,&no);
for(i=1;i<no;i++)
{
temp=temp * x / I;
sum=sum + temp;
}
printf(“Exponent of x is %f\n”,sum);
}
Output:
Enter the numbers
5
26 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I
Exponent of x is 65.375000
Algorithm:
27 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I
Flow Chart:
start
Read N no of
triangle
for(i=1;j=n-I;i<=n;i++;j--)
for(k=1;k<=l;k++)
Print “ “
for(k=1;k<=l;k++)
Print i
stop
Source Code:
#include<stdio.h>
main()
{
int i,j,k,l,n;
28 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I
OUTPUT
Type N-no of lines in triangle
4
1
2 2 2
3 3 3 3 3
4 4 4 4 4 4 4
Algorithm:
Flow Chart:
start
Read noline
For(i=1;i<=noline;i++) B
For(j=1;j<=noline;j++)
Print “ ”
Temp=I
For(j=1;j<I;j++)
Print
temp++
Temp=temp-2
30 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I
For(j=1;j<I;j++)
Print temp--
stop
Source Code:
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int line,c,n,x;
void pasc(int);
printf("\n\nEnter the no. of rows: ");
scanf("%d",&line);
printf("\n\n\n");
printf("\nPascal's triangle :\n");
for(x=line-1;x>=0;x--)
printf(" ");
printf("1\n\n");
for(n=2;n<=line;n++)
{
for(c=line-n;c>=1;c--)
printf(" ");
pasc(n);
printf("\n");
}
getch();
}
void pasc(int n)
{
31 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I
int r;
long fact(int);
for(r=0;r<=n;r++)
printf("%3ld ",fact(n)/(fact(n-r)*fact(r)));
}
long fact(int v)
{
if(v==1||v==0)
return(1);
else
return(v*fact(v-1));
}
Output
Algorithm:
32 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I
Flow chart
start
Read m,n
For i=0 to m
For j=0 to n
Read a[i][j]
Read b[i][j]
For i=0 to m
Print “\n”
For j=0 to n
C[i][j]=a[i][j]+b[i][j]
Print c[i][j]
stop
33 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I
Program
#include<stdio.h>
#include<conio.h>
void main()
{
int a[10][10],b[10][10],c[10][10];
int i,j,m,n;
clrscr();
printf("Enter row and column of two matrices : ");
scanf("%d%d",&m,&n);
printf("Enter the elements of A matrix.\n");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
scanf("%d",&a[i][j]);
}
printf("Enter the elements of B matrix. \n");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
scanf("%d",&b[i][j]);
}
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
c[i][j]=a[i][j]+b[i][j];
}
}
printf("Addition of A and B matrix:\n");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
printf("%5d",c[i][j]);
printf("\n");
}
}
34 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I
OUTPUT
Aim: To write a program to find the string length and concatenation of string.
Algorithm:
Step 1: Start the program
Step 2: Enter the String
Step 3: Find the string length using the function strlen()
Step 4: Print the string length of the entered string
Step 5: Concatenate the two string using the function strcat()
Step 6: Print the concatenated string
Step 7:Stop.
35 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I
Flow chart
start
S1=strlen(s1)
S1=strcat(s1,s2)
stop
Source Code:
#include<stdio.h>
#include<conio.h>
void main()
{
char str1[50],str2[]=”WELCOME”;
int len;
printf(“Enter the string”);
scanf(“%s”.str1):
printf(“The String length of %s is %d, str1,strlen(str1));
printf(“The concatenated string length is %d and its string is %s”,strlen(str1),strcat(str1,str2));
}
Output:
Enter the string…. CSE
The string length of CSE is 3
The concatenation string length is 6 and its string is CSE WELCOME
36 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I
Aim: To write a program to assigning values to the structures variables and retrieving values.
Algorithm:
Step 1: Start the program
Step 2: Struct Std
Rno, Marks : integer
Name[10] :character
End
Step 3: Read S.rno, S.name,S.marks
Step 4: Print S.no,S.name,S.marks
Step 5: Stop
Flowchart:
start
struct std
Rno,marks:integer
Name[10]: character
End std
Read s.rno,s.name,s.marks
print s.rno,s.name,s.marks
stop
Source Code:
#include<stdio.h>
#include<conio.h>
Struct std
37 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I
{
int rno,marks;
char name[10];
}s;
void main()
{
clrscr();
printf(“Enter Student Details:\n”);
printf(“Enter the Register No,Name and Mark\n”);
scanf(“%d%s%d”,&s.rno,s.name,&s.marks);
printf(“\n’);
printf(“Rollno\t\t Name\t\tMarks\n’);
printf(“%d\t\t%s\t\t%d”,s.rno,s.name,s.marks);
getch();
}
Output:
Algorithm:
Step 1: Start
Step 2 : UnionStd
Rno, marks :integer
Name[10]: cjaracter
End Union
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
Flow Chart:
38 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I
start
Union std
Rno,marks:integer
Name[10]: character
End std
Read n
For(i=0;i<n;i++)
Read s[i].rno,s[i].name,s[i].m.marks
print s.rno,s.name,s.marks
stop
Source Code:
#include<stdio.h>
#include<conio.h.
typedef union std
{
int rno;
char name[10];
int marks;
39 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I
}student;
void main()
{
int I,n;
clrscr();
printf(“Enter upper limit”);
scanf(“%d”,&n);
printf(“Enter student details”);
printf(“Enter the Roll no, Nmae 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(“Roll no \t name\t\t Name\t\t Marks\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);
get6=ch():
}
OUTPUT:
Enter the upper limit: 3
Enter student details:
Enter the Rollno, Name and Mark:
111 Ram 80
222 Ravi 78
333 Mani 80
Algorithm:
Step 1: Start
Step 2: read num
Step 3: arecur(num)
Step 4: print num,a;
Step 5: Stop
Step 1: recur start
Step 2: fact 1
40 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I
Step 3: Is no=1
T : return
F : fact no * recur(no-1)
Step 4: return
Flow chart
start
Read num
A=recur(num)
Print a
stop
Recur(no)
41 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I
No
Is(no=1) Fact=no*recur(no-1)
yes
return
Source Code:
#include<stdio.h>
#include<conio.h>
void main()
{
int num,a;
printf(“Enter the number”);
scanf(“%d”,&num);
a=recur(num);
printf(“The factorial of the number %d is %d”,num,a);
}
recur(int no)
{
int fact=1;
if(no==1)
return(1);
else
fact=no * recur(no-1);
}
Output
Enter the number 5
The factorial of the number 5 is 120
42 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I
VALUES
Aim: To write a program to illustrate a function with arguments with return bvalues.
Algorithm:
Step 1: Start the program
Step 2: Enter the two numbers
Step 3: Call the function with two arguments passed to it
Step 4: Add the two numbers in the calling function
Step 5:Return the addition value to the called function from the calling function.
Step 6: Print the addition value in the main function
Step 7; Stop
FLOW CHART:
Start
read a,b
c=a+b
print c
return c
Stop
Source Code:
43 R. M. D. ENGINEERING COLLEGE
GE2115-COMPUTER PRACTICE LABORATORY-I
#include<stdio.h>
main()
{
int a,b,c;
pinntf(“Enter the numbers.”);
scanf(“%d%d”,&a,&b);
c=add(a,b);
printf(“The addition of two numbers %d and %d is %d”,a,b,c);
}
add(int x, int y)
{
int z;
z=x+y;
return(z);
}
Output:
44 R. M. D. ENGINEERING COLLEGE