memberfiles.freewebs.commemberfiles.freewebs.com/41/80/81268041/documents/123.docx · web viewto...

113
EX.NO : ADVERTISMENT USING MS WORD DATE : AIM: To create an advertisement using Microsoft Word. ALGORITHM: Step 1 : Go to Start Menu and select Microsoft Word . Step 2 : Blank document is selected to create a new advertisement for an engineering college. Step 3 : Using Table option to insert a 1×1 table. Step 4 : Insert a picture on the left corner of the advertisement. Step 5 : Type the engineering college name and its affiliated university as the title of the advertisement. Step 6 : Insert a horizontal line in the table cell. Step 7 : Insert a Text Box inside the table cell and insert a oval shape in the text box to mention the title ‘U.G. Courses’.

Upload: duongtruc

Post on 15-Jul-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

EX.NO : ADVERTISMENT USING MS WORDDATE :

AIM:

To create an advertisement using Microsoft Word.

ALGORITHM:

Step 1 : Go to Start Menu and select Microsoft Word .

Step 2 : Blank document is selected to create a new advertisement for an engineering college.

Step 3 : Using Table option to insert a 1×1 table.

Step 4 : Insert a picture on the left corner of the advertisement.

Step 5 : Type the engineering college name and its affiliated university as the title of the advertisement.

Step 6 : Insert a horizontal line in the table cell.

Step 7 : Insert a Text Box inside the table cell and insert a oval shape in the text box to mention the title ‘U.G. Courses’.

Step 8 : Include bullets in the text box to list the U.G courses available in the engineering College.

Step 9 : Insert a call out option to mention the eligibility.

Step 10: Insert a Text Box inside the table cell and insert a oval shape in the text box to mention the title ‘P.G. Courses’.

Step 11: Include bullets in the text box to list the ‘P.G courses’ available in the engineering College.

Step 12: Insert a call out option to mention the eligibility.

Step 13: Insert a Text Box inside the table cell and mention the facilities available in the college using bullets.

Step 14: Include bullets in the text box to list the P.G courses available in the engineering College.

Step 15: Insert a Text Box inside the table cell and mention the contact details for admission

Step 16: Save the file and exit.

RESULT:

EX.NO: CREATION OF TABLE USING

DATE : MS WORD

AIM: To create a table and chart using MS word.

ALGORITHM:

STEP 1: MS Word is selected from MS office from start menu.

STEP 2: A new document is selected from file menu.

STEP 3: Table is selected from insert in table menu.

STEP 4: A table dialog box appears.

STEP 5:Select the desired number of rows and columns and click

apply.

STEP 6: The table with desired rows and columns will appear.

STEP 7: The data can be typed in each cell by placing cursor in each cell.

STEP 8: The entire table is selected.

STEP 9: Table properties are selected from table menu to change the table

properties.

STEP 10: The properties like border, colors, line style, etc can be changed.

Click OK.

STEP 11: To sort the information in the table sort option is selected from

table menu.

STEP12: To insert the chart for the information in table, at first the entire

table is selected.

STEP13: Chart option is selected from insert menu.

STEP14: The chart with corresponding data will appear.

STEP15: Stop

OUTPUT:

Name Mark1 Mark2 Mark3 Total Average

Faraday 86 78 98 262 87.33

Jehovah 89 90 89 268 89.33

Monica 54 67 100 221 77

Rita 95 78 94 267 89

Mark1 Mark2 Mark3 Total Average 0

50

100

150

200

250

300

FaradayJehovahMonicaRita

RESULT:

EX. NO: SCIENTIFIC NOTATION DATE:

AIM:

To create equations using Microsoft word.

ALGORITHM:

STEP 1 : Go to start menu select Microsoft office.STEP 2 : Select object option from insert menu.STEP 3 : An object dialog box appears.STEP 4 : Select Microsoft Equation 3.0. Click OK.STEP 5 : The equation editor appears.STEP 6 : The equation dialog box in the equation editor enables to type equations.STEP 7 : The desired equation is typed using equation dialog box options.STEP 8 : The document is saved after typing.STEP 9: Stop

OUTPUT:

Sn=n2 [2a+(n−1)d ¿ ¿∫ dx√a2−x2

=sin−1 xa ¿ lim

x→0(1+1

x )x=e ¿SY=√{∑ ( y−y p)

n }¿∑n=0

∞ 1n !

=e−1 ¿¿

RESULT:

EX.NO : FLOWCHART IN MS WORD DATE :

AIM: To draw a flowchart in MS Word.

ALGORITHM:

Step 1: Go to start menu to select MS Word.

Step 2: Using new menu create a page.

Step 3: From insert menu, select auto shapes option.

Step 4: Auto shapes provides a set of options.

Step 5: Flowchart options gives standard flowchart symbols.

Step 6: Using these options a flowchart is created.

Step 7: Left click on the symbol.

Step 8: A list will be displayed. Select add text to type text in the flow

inside the flowchart.

Step 9: Stop

OUTPUT:

.

start

Read a, b, c, d

Print the roots are real and

unequal.

d= (b*b)-(4*a*c)

If d>0

If d==0

r1= (-b+sqrt(d))/(2*a)r2 = (-b-sqrt(d))/(2*a)

r1=(-b)/(2*a)r2=(-b)/(2*a)

Print the roots are real and

equal.

Print r1 ,r2.

Stop

NO

YesYes

Print the roots are

imaginary.

No

RESULT:

EX.NO: CREATE EMPLOYEE SALARY DATE : DETAIL BY EXCEL

AIM: To create employee salary detail by using Microsoft Excel sheet PROCEDURE:Step 1: Start the program and select Excel work sheetStep 2: Enter the Employee No., Employee Name, Basic Salary for all employeesStep 3: Calculate HRA=18% of Basic Salary,Click in cell D2, type = C2 *18/100 Step 4: If Basic Salary >=8000, DA=70%of Basic SalaryOtherwise, DA=40%of Basic Salary.Click in cell E2 type = If (C2 > = 8000, C2 * 70/100, C2 * 40/100)Step 5: Calculate PF=10% OF Basic Salary, Click in cell F2 type = C2 * 0.1Step 6: Set CCA=500 for all employees.Step 7: Calculate Gross Salary=Basic Salary+HRA+DA+PF.Click in cell H2 type = D2 + E2 + F2 + G2 + C2Step 8: Calculate Net Salary=Gross Salary-PF. Click in cell I2 type = H2 – F2Step 9: Copy the formulae to the remaining recordsStep 10: stop

OUTPUT:

EMP.NO EMP NAME BASIC HRA DA PF CCA GROSS SALARY NET SALARYSR001 ZEUS 10000 1800 7000 1000 500 20300 19300SR002 ATHENA 8000 1440 5600 800 500 16340 15540SR003 CRATOS 5000 900 2000 500 500 8900 8400SR004 POSYDEN 3500 630 1400 350 500 6380 6030SR005 DAVENCE 8000 1440 5600 800 500 16340 15540

RESULT:

EX.NO: CREATE MARK LIST OF THE DATE : STUDENTS BY USING MS EXCEL

AIM:To create a mark list of the students by using Microsoft Excel sheets PROCEDURE:Step 1: Start>>goto>> MS Office and open Excel work sheetStep 2: Enter the student name, marks in five subjectsStep 3: Calculate total marks for five subjects, Place the cursor in H2, type = sum (C2: G2)Step 4: Calculate average marks of five subjects, Place the cursor in I2 ,type = Average (C2: G2)Step 5:Set result as ‘Pass’ if each subject mark is greater or equal to 40,otherwise ‘Fail’ Click on J2, type.=if((C2>=40)*AND(D2>=40)*AND(E2>=40)*AND(F2>=40)*AND(G2>=40),"pass","fail")Step 6: If percentage > 90 and result=pass set grade=outstanding Otherwise, percentage > 60 and result=pass set grade=first class Otherwise, percentage > 60 and result=pass set grade=first class. Click on K2 type = If ((I2 > = 90 *AND J2 = “Pass“), “outstanding “, If ((I2 > = 60 *AND J2 = “Pass“), “first class “, If ((I2 > = 40 *AND J2 = “Pass“), “second class”, “No class”)))Step 7: If result=pass, rank the students based on percentage. set grade Click on L2 type = If (J2 = “Pass“,Rank (H2, H2: H6),” “ )Step 8: Copy the formula to the remaining studentsStep 9: stop

OUTPUT:

ROLL NO NAME TAMIL ENGLISH CHEM BIOLOGY MATHS TOTAL PERCENTAGE RESULT GRADE RANK1 ZEUS 90 98 90 84 100 462 92.4 PASS OUTSTANDING 12 ATHENA 52 45 43 55 44 239 47.8 PASS SECONDCLASS 43 CRATOS 63 70 78 66 70 347 69.4 PASS FIRSTCLASS 34 POSYDEN 88 94 97 85 94 458 91.6 PASS OUTSTANDING 2

RESULT:

EX.NO: POWERPOINT PRESENTATION

DATE :

AIM: To create a presentation using Microsoft PowerPoint.

ALGORITHM:STEP1: Start go to Microsoft power point from Microsoft office.STEP 2: Open a blank presentation.STEP 3: Choose WORD ART option from the picture in insert menu selectio or click on WORDART button from the DRAWING Tool Bar. STEP 4: A WORD ART gallery dialog box opensSTEP5: From the word art gallery choose the appropriate style and Then type the text needed and click OK STEP6: Insert clipart from the Insert Menu.STEP7: Animate the presentation using animation then fix the time for slide Transition.STEP8: Presentation would be created successfully.STEP 9: Stop

OUTPUT:

SLIDE 1:

SLIDE 2:

SLIDE 3: KEYROLES Observe each and every student.

Friendly class hours.

Constant supervision on dull student.

Weekly\monthly tests.

Encouraging students in all aspects.

SLIDE 4:

RESULT:

EX. NO: CREATE A MERGED DOCUMENT

DATE : USING MICROSOFT WORD

AIM: To create merged document using Microsoft wordPROCEDURE:STEP 1: To enter Microsoft word, click “start” button then click “program”STEP 2: From “program” menu then click and chose “letters and mailings”, then click “mail merge” from itSTEP 4: Then proceed with the following six steps to create a merged document1. From the list of documents types available choose “letters”2. Select the recipients from the list. If the list is already available choose “use an existing list“otherwise choose “type a new list” and type the names and address of the recipients 4. Write the content of the letter. To add recipients information to the letter, click a location in the document and the click “Address block”5. One of the merged letter will be previewed and to preview another letter click one of the following <<Recipient: 1>>6. On clicking “complete the mail merge” mail merge is ready to produce the lettersSTEP 5: Now the document has been successfully created STEP 6: stop

OUTPUT:

SRIRAM ENGINEERING COLLEGEA Unit of SRIRAM Educational trust perumalpattu-24 tiruvallur OT PH: 044-27680364

TOV.SATHISH,19, Ravishankar nagar,Chennai 99.

Dear Sir, SUB: CALL LETTER

With reference to your application for a suitable post in our Organization, you are requested to appear for interview with all your testimonials for the post of lecturer in CSC department.

DATE OF INTERVIEW: TIME:

Yours faithfully

(CHAIRMAN)

SRIRAM ENGINEERING COLLEGE

A Unit of SRIRAM Educational trust perumalpattu-24 tiruvallur OT PH: 044-27680364

TOV.SHYAM SUNDAR,19, Gurushankar nagar,Chennai 79.

Dear Sir, SUB: CALL LETTER

With reference to your application for a suitable post in our Organization, you are requested to appear for interview with all your testimonials for the post of lecturer in CSC department.

DATE OF INTERVIEW: TIME:

Yours faithfully

(CHAIRMAN)

RESULT:

Ex. No: BASIC DATATYPE Date :

Aim:-

To write a C program to print the name and roll no. using Basic datatype.

Algorithm:-

STEP-1 :- Start.STEP-2 :- Read name, roll no.STEP-3 :- Print name, roll no.STEP-4 :- Stop.

Program:-

#include<stdio.h>#include<conio.h>void main(){ char name[50];clrscr();int roll no;printf("\n ENTER YOUR NAME AND YOUR ROLL NO:");scanf("%s%d",&name,&roll no);printf("\nNAME=%s,ROLL.NO=%d",name,roll_no);getch();}

Read name,roll_no

Print name,roll_no

Start

Stop

Flowchart:

Output:-

Result:-

Ex. No: SIMPLE CALCULATIONSDate :

Aim:-

To write a C program to find the area of square, rectangle, circle and circumference of the circle.

Algorithm:-

STEP-1 :- Start.STEP-2 :- Read l, b, s, r, area1, area2, area3, circumference, pi=3.14.STEP-3 :- area1=pi*r*r.STEP-4 :- circumference=2*pi*r.STEP-5 :- area2=s*s.STEP-6 :- area3=l*b.STEP-7 :- Print area1, area2, area3, circumference.STEP-8 :- Stop.

Program:-

#include<stdio.h>#include<conio.h>#define pi 3.14void main(){int s,l,b,r;clrscr();float area1,area2,area3,circumference;printf("Enter the values of radius, length, breadth, side :");scanf("%d%d%d%d",&r,&l,&b,&s);area1=pi*r*r;circumference=2*pi*r;area2=s*s;area3=l*b;printf("The area of circle=%f , square=%f, rectangle=%f ",area1,area2,area3);printf("The circumference of a circle is %f",circumference);getch();}

flowchart:-

Start

Stop

Read l, b, s, r, area1, area2, area3, circumference, pi=3.14

Print area1, area2, area3, circumference

area1=pi*r*r.

circumference = 2*pi*r

area2= s*s.

area3= l*b.

Output:-

Result:-

Ex. No: ODD OR EVENDate :

Aim:-

To write a C program find whether the given number is odd or even.

Algorithm:-

STEP-1 :- Start.STEP-2 :- Read num, c.STEP-3 :- if(num= = 0), then print it is neither odd or even otherwise go to step-4.STEP-4 :- else calculate c=num%2.STEP-5 :- if(c= =0), then print the given number is even, else print the given number is odd.STEP-6 :- Stop.

Program:-

#include<stdio.h>#include<conio.h>void main(){int num,c;clrscr();printf("\n Enter the no. :");scanf("%d",&num);if(num==0)printf("it is neither odd nor even");else{c=num%2;if(c==0)printf("\nThe given no. is even");elseprintf("\nThe given no. is odd");}getch();}

Flowchart:-

Read num, c

if(num= = 0)

Print the given number is neither odd nor even

if(c==0)

Print the given number is even

c = num%2

Print the given number is odd

Start

Stop

True False

True False

Output:-

Result:-

Ex. No: BIGGEST OF THREE NUMBERSDate :

Aim:-

To write a C program to find the biggest of three numbers.

Algorithm:-

STEP-1 :- Start.STEP-2 :- Read a, b, c,max.STEP-3 :- if(a>b), then if(a>c), then max = a, otherwise max = c, else go to step-4.STEP-4 :- if(b>c), then max = b, else max = c.STEP-5 :- Print ‘max’ is the biggest value.STEP-6 :- Stop.

Program:-

#include<stdio.h>#include<conio.h>void main(){int a,b,c,max;clrscr();printf("\nEnter the three nos\t:");scanf("%d%d%d",&a,&b,&c);if(a>b){if(a>c)max = a;elsemax = c;}else if(b>c)max = b;elsemax = c;printf("%d is the biggest value",max);getch();}

Read a, b, c, max

max=a

if(a>c) if(b>c)

max=c

if(a>b)

max=b

Start

Stop

True False

max=c

TrueFalse True False

Print ‘max’ is the biggest

Flowchart:-

Output:-

Result:-

Ex. No: AMSTRONG OR NOTDate :

Aim:-

To write a C program to find whether the given number is amstrong or not.

Algorithm:-

STEP-1 :- Start.STEP-2 :- Read n,t,s,r.STEP-3 :- Let t=n & s=0.STEP-4 :- while(n>0), calculate r =n%10, s=s+(r*r*r) & n=n/10.STEP-5 :- if(t = = s), print ‘t’ is an amstrong number , else print ‘t’ is not an amstrong number.STEP-6 :- Stop.

Program:-

#include<stdio.h>#include<conio.h>void main(){int n,t,s,r; clrscr();printf("\n Enter the number");scanf("%d",&n);t=n;s=0;while(n>0){r =n%10;s =s+(r*r*r);n =n/10;}if(t==s)printf("\n %d is an amstrong number",t);elseprintf("\n %d is not an amstrong number ",t);getch();}

Flowchart:-

Start

Stop

while(n>0)

Print ‘t’ is an amstrong numberPrint ‘t’ is not an amstrong number

Read n,t,s,r

t=n & s=0

if(t==s)

r=n%10

s=s+(r*r*r)

n=n/10

True False

Output:-

Result:-

Ex. No: PERFECT OR NOTDate :

Aim:-

To write a C program to find whether the given number is perfect or not.

Algorithm:-

STEP-1 :- Start.STEP-2 :- Read num,temp=1,i=0,c=0,k.STEP-3 :- while(temp<=num/2), k=num%temp.STEP-4 :- if(k= = 0) ,c=temp+i & i=c, then temp++.STEP-5 :- if(c= =num), print the given no. is a perfect no., else print the given no. is not a perfect no.STEP-6:- Stop.

Program:-

#include<stdio.h>#include<conio.h>void main(){int num,temp=1,i=0,c=0,k;clrscr();printf("Enter the no. :");scanf("%d",&num);while(temp<=num/2){ k=num%temp; if(k==0) {c=temp+i;i=c; } temp++; }if(c==num)printf("The given no. is a perfect no.");elseprintf("The given no. is not a perfect no.");getch();}

Start

Read num, temp=0, c=0, i=0, k.

k=num%temp

if(k==0) c=temp+i

while(temp<=num/2)

i=ctemp+ +

if(c==num)

Print the given no. is a perfect no.Print the given no. is not a perfect no.

Stop

True

False

True False

Flowchart:-

Output:-

Result:-

Ex. No: PALINDROME OR NOTDate :

Aim:-

To write a C program to find the given string is palindrome or not.

Algorithm:-

STEP-1 :- Start.STEP-2 :- Read input,copy,condition,length,i.STEP-3 :- To find length of string use length=strlen(input).STEP-4 :- for(i=0;i<length;i++) and to change the string to upper case use input[i]=toupper(input[i]).STEP-5 :- To copy the string use strcpy(input,copy).STEP-6 :- Reverse the string by strrev(input).STEP-7 :- condition=strcmp(input,copy).STEP-8 :- if(condition= = 0) print the given input is palindrome, else print the given string is not palindrome. STEP-9 :- Stop.

Program:-

#include<stdio.h>#include<conio.h>#include<string.h>#include<ctype.h>void main(){char input[50],copy[50];clrscr();int condition,length,i;printf("Enter the input :");scanf("%s",input);length = strlen(input);for (i=0; i<length; i++){ input[i] = toupper(input[i]);}strcpy(copy,input);strrev(input);condition = strcmp(input,copy);if(condition == 0)printf("\nThe given input is palindrome");elseprintf("\n The given input is not palindrome");getch();}

Flowchart:-

Start

Read input, copy, i, length, condition

length= strlen(input)

for(i=0;i<length;i+ +)

input[i]=toupper(input[i]).

strcpy(input,copy).

strrev(input).

condition=strcmp(input,copy).

Print the given input is palindrome

if(condition= = 0)

print the given input is not palindrome

Stop

True False

Output:-

Result:-

Ex. No: PASCAL TRIANGLE

Date :

Aim:-

To write a C program to draw a PASCAL triangle.

Algorithm:-

STEP-1 :- Start.STEP-2 :- Declare the integer variables i, j, k, m, n.STEP-3 :- Read number of rows, n. STEP-4 :- Initialize i=1 and j=0.STEP-5 :- Repeat steps 6 to 17 until j<n.STEP-6 :- Initialize k=35-2*j.STEP-7 :- Repeat the steps 8 to 16 until k>0.STEP-8 :- Print Blank Space.STEP-9 :- Initialize m=0.STEP-10:-Repeat the steps 11 to 13 until m<=j.STEP-11:-If (m==0 || j==0) set i=1 Otherwise, i=(i*(j-m+1))/m.STEP-12:- Print i.STEP-13:-Compute m=m+1.STEP-14:-Print blank line.STEP-15:-Compute k=k-1STEP-16:-Compute j=j+1.STEP-17:-Stop.

Program:-

#include<stdio.h>#include<conio.h>

void main(){int i=1,j,k,m,n;clrscr();printf("\n enter the number of rows\t");scanf("%d",&n);for(j=0;j<n;j++){for(k=30-2*j;k>0;k--){printf(" ");}for(m=0;m<=j;m++){if((m==0) || (j==0))i=1;elsei=(i*(j-m+1))/m;printf("%5d",i);}printf("\n");}getch();}

Output:-

Enter the number of rows 4

1

1 1

1 2 1

1 3 3 1

Result:-

Ex. No: SUM OF DIGITS Date :

Aim:-

To write a C program to print the sum of digits of a given number.

Algorithm:-

STEP-1 :- Start.STEP-2 :- Read num,sum=0,rem.STEP-3 :- While(num>0), rem = num%10,sum =sum+rem,num=num/10STEP-4 :- Print sum.STEP-5:- Stop.

Program:-

#include<stdio.h>#include<conio.h>void main(){

long int num, rem, sum=0;clrscr(); printf("Enter the Number: ");scanf("%ld", &num);while(num>0){rem = num%10;sum = sum + rem;num = num/10;}printf("The Sum of digits of the Given Number is: %ld ",sum);getch();}

Flowchart:-

Read num,rem sum=0,

Print sum

Start

Stop

while num>0

rem=num%10

num=num/10

sum=sum+rem

Output:

Result:-

Ex. No: FIBONACCI SERIES Date :

Aim:-

To write a C program to print the Fibonacci Series.

Algorithm:-

STEP-1 :- Start.STEP-2 :- Read l=-1,j=1,n,k,i.STEP-3 :- for(i=0,i<n,i++), STEP-4:- k=l+j,STEP-5 :- Print sum.STEP-6 :- l=j;STEP-7 :- j=k;STEP-8 :- Go to STEP 3.STEP-9:- Stop.

Program:-

#include<stdio.h>#include<conio.h>void main(){

int l = -1,j = 1,i,n,k; clrscr();

printf("Enter the number of terms: ");scanf("%d",&n);printf("\n\t\t\t FIBONACCI SERIES\t\t\t\n ");for(i = 0; i<n ; i++){k =l+j;printf(" %d \t",k);l = j;j = k;}getch();}

Flowchart:-

Read l=-1,j=1,n,k,i

Start

Stop

For i=0,i<n,i++

k = l+j

j = k

l = j

Print k

Output:-

Result:-

Ex. No: SUM OF ARRAY ELEMENTSDate :

Aim:-

To write a C program to print the sum of array of a given number.

Algorithm:-

STEP-1 :- Start.STEP-2 :- Read a[5],b[5],c[5],i,j,k.STEP-3 :- Get values for Array a[5].STEP-4 :- Get values for Array b[5].STEP-5:- Array c[5] is Sum of Array a[5] and b[5].STEP-6:- Print Array c[5].STEP-7 :- Stop.

Program:-

#include<stdio.h>#include<conio.h>void main(){ int a[5],b[5],c[5],i,j,k; clrscr(); printf("\n\t Enter 5 numbers in array 1:\n\t\t"); for(i=0;i<5;i++) { scanf("\t%d",&a[i]); } printf("\n\t Enter 5 numbers in array 2:\n\t\t"); for(j=0;j<5;j++) { scanf("\t%d",&b[j]); } for(k=0;k<5;k++) {c[k]=a[k]+b[k]; } printf("\n\t Sum of the given array:\n\n" ); for(k=0;k<5;k++) {printf("\t%d",c[k]); } getch();}

Flowchart:-

Read a[5],b[5],c[5],i,j,k

Start

Stop

For i =0,i<5,i++

Read a[i]

For j =0,j<5,j++

For k=0,k<5,k++

c[k] = a[k]+b[k]

Read b[j]

print c[k]

Output:-

Result:-

Ex. No: PRIME NUMBER OR NOT

Date :

Aim:-

To write a C program that prints the given number is prime or not.

Algorithm:-

STEP-1 :- Start.STEP-2 :- Read num,temp=2,k.STEP-3 :- While(temp<=num/2), k= num%tempSTEP-4 :- if k = 0STEP-5:- Print Number is CompositeSTEP-6:- temp++ goto step 3STEP-7:- Print Number is Prime STEP-8 :- Stop.

Program:-

#include<stdio.h>#include<conio.h>

void main(){long int num, temp =2, k; clrscr(); printf("Enter the number: ");scanf("%ld",&num);while(temp<=num/2){k = num%temp;if(k == 0){printf("\n\n\n\t\t The Number Is Composite!!");getch();exit(0);}temp++;}printf("\n\n\n\t\tThe Number is Prime!!");getch();}

Flowchart:-

Read num,temp=2,k

Print Prime

Start

Stop

While temp<=num/2

k=num%temp

temp++

Print CompositeIF k=0

Stop

True

False

Output:

Result:-

Ex. No: STRUCTURES Date :

Aim:-

To write a C program to use structures to print name and addressof student.

Algorithm:-

STEP-1 :- Start.STEP-2 :- Read Structure addr,student.STEP-3 :- Read structure members name,doorno,strtname,place,citySTEP-4 :- Print structure members name,doorno,strtname,place,city STEP-5 :- Stop.

Program:-

#include<stdio.h>#include<conio.h>struct addr{int doorno;char strtname[15];

char place[20];char city[20];};struct student{char name[15];struct addr address;}s1;void main(){clrscr();printf("\n\t\t Enter Student Name: ");gets(s1.name);printf("\n\t Enter Address: \n");printf("\n\t\t Enter Door number : ");printf(“%d”,&s1.address.doorno);printf("\n\t\t Enter Street name : ");scanf(“%s”,s1.address.strtname);printf("\n\t\t Enter Place : ");scanf(“%s”,s1.address.place);printf("\n\t\t Enter City : ");scanf(“%s”,s1.address.city);printf("\n\n\n\t\t Student Name: ");puts(s1.name);printf("\n\t Address: \n");printf("\n\t\t Door number : ");puts(s1.address.doorno);printf("\n\t\t Street name : ");puts(s1.address.strtname);printf("\n\t\t Place : ");puts(s1.address.place);printf("\n\t\t City : ");puts(s1.address.city);getch();}

Flowchart:-

Read name,doorno ,strtname,place,city.

Print name,doorno ,strtname,place,city.

Start

Stop

struct addrdoorno : intstrtname,place,city: charend addr

struct studentname : charaddress : struct addrend student

Output:-

Result:-

Ex. No: CALL BY VALUEDate :

Aim:-

To write a C program that calls a function by call by value.

Algorithm:-

STEP-1 :- Start.STEP-2 :- Read a,b.STEP-3 :- Print a,b.STEP-4 :- call swap(a,b)STEP-5 :- Print a,bSTEP-6 :- Stop

STEP-1 :- Start swap(a,b). STEP-2 :- temp = a, a = b, b =temp.STEP-3 :- Print a,b. STEP-4 :- Return.

Program:-

#include<stdio.h>#include<conio.h>void swap(int,int);void main(){int a,b;clrscr();printf("\n\t Enter a value for A: ");scanf("%d",&a);printf("\n\t Enter a value for B: ");scanf("%d",&b);printf("\n\n The values before swap - in main:\n");printf("\n\t Now the value for A: %d ",a);printf("\n\t Now the value for B: %d ",b);swap(a,b);printf("\n\n The values after swap - in main:\n");printf("\n\t Now the value for A: %d ",a);printf("\n\t Now the value for B: %d ",b);getch();}void swap(int a,int b){int temp;temp=a;a=b;b=temp;printf("\n\n The values after swap-in swap function :\n");printf("\n\t Now the value for A: %d ",a);printf("\n\t Now the value for B: %d ",b);}

Flowchart:-

Read a, b

Start

Stop

Print a, b

swap(a,b)

temp = a a = b b = temp

swap(a, b)

Print a , b

Print a , b

Return

Output:-

Enter a value for A: 345

Enter a value for B: 789

The values before swap - in main:

Now the value for A: 345 Now the value for B: 789

The values after swap-in swap function :

Now the value for A: 789 Now the value for B: 345

The values after swap - in main:

Now the value for A: 345 Now the value for B: 789

Result:-

Ex. No: CALL BY REFERENCE Date :

Aim:-

To write a C program that calls a function by call by reference.

Algorithm:-

STEP-1 :- Start.STEP-2 :- Read a,b.STEP-3 :- Print a,b.STEP-4 :- call function (&a,&b)STEP-5 :- Print a,bSTEP-6 :- Stop

STEP-1 :- Start function(*a,*b). STEP-2 :- temp =* a, *a =*b,*b =temp.STEP-3 :- Print a,b. STEP-4 :- Return.

Program:-

#include<stdio.h>#include<conio.h>void function(int *, int *);void main(){int a,b;clrscr();printf("\n\t Enter a value for A: ");scanf("%d",&a);printf("\n\t Enter a value for B: ");scanf("%d",&b);printf("\n\n The values before swap are:\n");printf("\n\t Now the value for A: %d ",a);printf("\n\t Now the value for B: %d ",b);function(&a,&b);printf("\n\n The values after swap are:\n");printf("\n\t Now the value for A: %d ",a);printf("\n\t Now the value for B: %d ",b);getch();}void function(int *a,int *b){int temp;temp = *a;*a=*b;*b=temp;return;}

Read a,b

Start

Stop

Print a,b

function(*a,*b)

temp = *a *a = *b*b = temp

function(&a,& b)

Print a, b

Return

Flowchart:-

Output:-

Result:-

Ex. No: FACTORIAL

Date :

Aim:-

To write a C program to print the Factorial of a given number.

Algorithm:-

STEP-1 :- Start.STEP-2 :- Read num,output.STEP-3 :- output =fact(num). STEP-4:- Definition of fact(num) STEP-5 :- Read fact =1STEP-6 :- While(num>0),fact =fact*num,num--.STEP-7 :- Return fact.STEP-8 :- Print factSTEP-9:- Stop.

Program:-

#include<stdio.h>#include<conio.h>long int fact(long int n);void main(){

long int num, output; clrscr();printf("Enter the number: ");scanf("%ld",&num);output = fact(num);printf("\n\n\n\t\tThe Factorial of the number is: %ld",output);getch();}long int fact(long int num){long int fact = 1;while(num>0){fact = fact*num;num--;}return fact;}

Flowchart:-

Print fact

Start

Stop

Read num,output,fact=1

fact(num)

fact(num)

While num>0

fact =fact*num

num--

return fact

Output:-

Result:-