foc_labmanual

download foc_labmanual

of 48

Transcript of foc_labmanual

  • 8/8/2019 foc_labmanual

    1/48

    Ex.No: 1.1 Document creation and Text Manipulation

    Date :

    Aim:

    Create the document containing the text given below, and perform the following tasks:

    A Flowchart is a diagrammatic representtion of instructons to perform a particulartask.

    A program is a set of instructons, which are executed by a computer, in order to

    perform specific tasks.

    There are so many computer languages such as BASIC, COBOL, FORTRAN,PASCAL, C, C++.

    (i) Justify the text.

    (ii) The words such as BASIC, COBOL, FORTRAN, PASCAL, C, C++ must be inbold size.

    (iii) Correct the spellings such as representtion, instructons.(iv) Show the words Flowchart, Program in Italic style and Underline them.

    (v) Save the document under a suitable name.

    Procedure:

    1.Open a new document using File -> New option and type text. For Justification

    select the entire text in the document. Then press CTRL+J or select the Justify

    button on the formatting tool bar.

    2.Select the word you want to change into bold face. Then press CTRL+B or select the

    Bold button on the formatting tool bar.

    3.For Spelling corrections, select the word you want to correct, then right click the

    mouse or clickSpelling and Grammar button on the standard tool bar.

    4.Select the word which you want to make Italic style then press CTRL+I or select the

    Italic button on the formatting tool bar. For Underline press CTRL+U or select the

    Underline button on the formatting tool bar.

    5.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. Then it shows the SaveAs dialog

    box. Choose a suitable file name in File Name text box, then clickSave button on

    Save As dialog box.

  • 8/8/2019 foc_labmanual

    2/48

    Output:

    A Flowchart is a diagrammatic representation of instructions to perform a particular

    task.

    A program is a set of instructions, which are executed by a computer, in order to

    perform specific tasks.There are so many computer languages such as BASIC, COBOL, FORTRAN,

    PASCAL, C, C++.

    Result:

    Thus the document created using MS WORD and Text manipulation done

    successfully.

  • 8/8/2019 foc_labmanual

    3/48

    Ex.No: 1.2 Table Creation and Table formatting

    Date :

    Aim:

    Creating Table with sample data and formatting table using Table Properties.

    Procedure:

    1. Choose Table -> Insert -> Table option.

    2. It shows the Insert Table dialog box.

    3. Then choose the required number of columns and rows.

    4. Then click OK to add table in your document

    5. Then type the text in each column

  • 8/8/2019 foc_labmanual

    4/48

    Output:

    Book Name Author

    Computer Practice-IV. Ramesh Babu

    Y. Samyuktha

    Computer Practice-IIV. Ramesh Babu

    M. Muni Rathnam

    Engineering Mechanics V. Ramesh Babu

    Engineering Drawing V. Ramesh Babu

    Result:

    Thus the document created using MS WORD and Text manipulation done

    successfully.

  • 8/8/2019 foc_labmanual

    5/48

    Ex.No: 1.3 Mail Merge for sending Resume

    Date :

    Aim:

    To create a Mail Merge for sending the Bio Data.

    Procedure:

    1. Select Tools -> Letters and Mailing -> MailMerge Wizard.

    2. Select letters then click on starting document

    3. Choose use the current document then click on select recipient

    4. Choose Type a new list, click on create, a New Address list dialog box will be

    display

    5. Type the required details then click close

    6. Save address list dialog box will be display, type filename and save it

    7. Mail Merge Recipient dialog box will be display, click ok.

    8. Click on write your letter

    9. Write the bio-data in the document , place the cursor on To place then click on

    address block

    10. Insert Address block dialog box will be display, select any type then click ok

    11. Click on preview your letter

    12. Select the recipient then click on complete the merge

    13. Click on Edit individual letter, Merger to new document dialog box will be display

    then select current record and click ok

    14. Finally Merged document will be create

  • 8/8/2019 foc_labmanual

    6/48

    Output:

    From

    Xxxx,Maamallan Nagar,

    Vadamangalam,

    Chennai.

    To

    Ramesh babu

    tcs

    73,S.N Chetty st

    Chennai - 6000081

    TamilNadu

    Bio Data

    Name : XXXX

    D.O.B : 23-jul-1988

    Address : Maamallan Nagar,Vadamangalam,Chennai.

    State : TamilNadu

    Country : India

    Result:

    Thus the document created using MS WORD and Mail Merge is done successfully.

    Ex.No: 1.4 Draw a flowchart to calculate the simple interest

  • 8/8/2019 foc_labmanual

    7/48

    Date :

    Aim:

    Draw a flowchart for calculating simple interest.

    Procedure:

    1. Find out the formula and necessary calculation.

    2. Select Insert -> shape -> Flowchart option.

    3. Choose the required flowchart symbol for Start.

    4. Choose the required flowchart symbol for Read.

    5. Choose the required flowchart symbol for Calculation.

    6. Choose the required flowchart symbol for Write.

    7. Choose the required flowchart symbol for Stop.

    Output:

  • 8/8/2019 foc_labmanual

    8/48

    Result:

    Thus the document created using MS WORD and flow chart is sketched successfully.

    Ex.No: 2.1 Creating chart using MS - Excel

    START

    STOP

    READ P, N, R

    SI = P*N*R/100

    WRITE SI

  • 8/8/2019 foc_labmanual

    9/48

    Date :

    Aim:

    Creating different type of Chart based on the sample data using MS Excel.

    The ABC Company the sales of different products for 5 years. Create Line, XY, Bar

    and Pie chart for the following.

    Procedure:

    1. Type the data as shown in the worksheet.

    2. Click at cell address A1, click Insert -> Chart.

    3. Excel will display the first dialog box of Chart Wizard.

    4. Select Graph type and click on Next.

    5. Click on Data Range from the Chart Wizard dialog box.

    6. Select A1 to E6, then click Next.7. Click in the chart title box, type ABC COMPANY.

    8. Click on the Category X-Axis, type YEAR

    9. Click on the Value Y-Axis type PRODUCT

    10. Click Next, then click FINISH

    11. Excel will display the created chart in the current worksheet.

  • 8/8/2019 foc_labmanual

    10/48

    Output:

    ABC - COMPANY

    0%

    20%

    40%

    60%

    80%

    100%

    1 2 3 4 5

    YEAR

    PRODU

    Series5

    Series4

    Series3

    Series2

    Series1

    ABC - COMPANY

    0

    200

    400

    600

    800

    1000

    1200

    1998 2000 2002 2004 2006

    YEAR

    PRODU

    Series1

    Series2

    Series3

    Series4

    ABC - COMPANY

    0 2000 4000 6000

    1

    2

    3

    4

    5

    PRODU

    YEAR

    Series1

    Series2

    Series3

    Series4

    Series5

  • 8/8/2019 foc_labmanual

    11/48

    ABC - COMPANY

    1

    2

    3

    4

    5

    Ex.No: 2.2 MS-Excel - Using formula Bar

    Date :

    Aim:

    Calculate HRA, DA, TA, PF, LIC, Gross Salary, Deductions, Net salary from given

    data in a worksheet.

    ENO Name Basic HRA TA DA LIC PF GPF GS DED NET

    1 Abc 20000

    2 Asd 15000

    3 Bfr 10000

    4 Cde 78205 Erg 4569

    Where

    HRA is 18% of BASIC

    DA is 15% of BASIC

    TA is 12% of BASIC

    PF is 10% of BASIC

    LIC is 7% of BASIC

    GS (Gross Salary) = BASIC + HRA + DA + TA

    DED (Deductions) = PF + LIC

  • 8/8/2019 foc_labmanual

    12/48

    NS (Net Salary) = GS DED

    Procedure:

    1. For HRA put the cell pointer in D3 and press = (equal to) for entering the

    formula. Then choose the C3 cell (Basic Salary) and type * (multiplication

    operator) and type 18% then press enter.

    2. Then drag that formula for entire records.

    3. For TA put the cell pointer in E3 and press = (equal to) for entering the

    formula. Then choose the C3 cell (Basic Salary) and type * (multiplication

    operator) and type 15% then press enter.

    4. Then drag that formula for entire records.

    5. Follow the above steps for calculation of DA, PF, LIC.

    6. For GS (Gross Salary) put the cell pointer in I3 and choose the = , then click on C3

    cell + click on D3 + click on E3 + click on F3 and press enter.

    7. Drag all the cell

    8. Follow the above step for DED and NS calculation.

  • 8/8/2019 foc_labmanual

    13/48

    Output:

  • 8/8/2019 foc_labmanual

    14/48

    Result:

    Thus the excel sheet created using MS EXCEL formula bar, the HRA and DA

    calculated Successfully.

    Ex.No: 2.3 MS-Excel - Inserting Object in MS-Excel

    Date :

    Aim:

    i. Insert object in the worksheet

    ii. Insert picture in the worksheet

    iii. Protect a sheet

    Procedure:

    1. To enter Microsoft Excel, Click start button then click program from programs

    menu then click Microsoft Excel

    2. For opening a word document do the following. Click file menu from the menu bar.

    From this file menu click new option. This will display the new work sheet.

    3. For inserting object in the worksheet, choose objects option in the insert menu

    4. For inserting picture in the worksheet, choose Picture option in the insert menu

    5. For protecting your worksheet, choose Protection option from Tools menu, then choose

    Protect Sheet option, Protect sheet dialog box appears. Type a password and press

    enter.

    6. Now your worksheet is protected and can be entered only with the password.

  • 8/8/2019 foc_labmanual

    15/48

    Output:

  • 8/8/2019 foc_labmanual

    16/48

    Result:

    Thus the excel sheet created using MS EXCEL , the object and picture inserted

    Successfully.

    Ex.No: 3 Write a simple C program for menu driven calculator using switch statement

    Date :

    Aim:

    To write a menu driven program to find

    1. Factorial of the given number2. Prime number or not

    3. Even number or Odd number 4. Exit

    Algorithm:

    Step-1 Start the program

    Step-2 Enter the number Step-3 Enter your choice using switch statement

    Step-4 If you choose the choice 1. Find the factorial

    Step-5 set a loop up to the entered number Step-6 Calculate factorial fact=fact*IStep-7 Print the factorial value

    Step-8 If you choose the choice 2.Find whether the number is prime or not

    Step-9 set a loop up to number-1Step-10 Check the number is divide by any number other than one

    and the number itself

    Step-11 If divide absolutely then print the number is not a primeStep-12 If not divide other than one and itself then print the number is prime

    Step-13 If you choose the choice 3. Find whether the number is odd or even

    Step-14 If the number is divide by 2 then print the number is even

    Step-15 If the number is not dividing by 2 then print the number is oddStep-16 If you choose the choice 4.Exit the program

    Step-17 Continue the program

  • 8/8/2019 foc_labmanual

    17/48

    Program: 3

    #include#include

    void main()

    {

    int a,b,c,n;clrscr();

    printf("--MENU--");printf("\n1.Addition\n2.Subtraction\n3.Multiply\n4.Division\n0.Exit");

    printf("\nEnter your choice:");

    scanf("%d",&n);

    if(n0){

    printf("\nEnter two numbers:");

    scanf("%d%d",&a,&b);}

    switch(n)

    {case 1:

    c=a+b;

    printf("Addition :%d",c);break;

    case 2:

    c=a-b;

    printf("Subtraction :%d",c);break;

    case 3:

    c=a*b;printf("Multiplication :%d",c);

    break;

    case 4:c=a/b;

    printf("Division :%d",c);

    break;

    case 0:

  • 8/8/2019 foc_labmanual

    18/48

    exit(0);

    break;

    default:printf("Invalid choice");

    }

    getch();}

    Output:

    --MENU--

    1.Addition

    2.Subtraction

    3.Multiply4.Division

    0.ExitEnter your choice:3

    Enter two numbers:4 5

    Multiplication :20

  • 8/8/2019 foc_labmanual

    19/48

    Ex.No: 4 Write a simple C program for finding whether the number is Prime or Not

    Date :

    Aim:

    To write a program to find whether the number is prime or not.

    Algorithm:

    Step-1 Start the program

    Step-2 Enter the number

    Step-3 set a loop up to number-1

    Step-4 Check the number is divide by any number other than one and thenumber itself

    Step-5 If divide absolutely than print the number is not a prime

    Step-6 If not divide other then one and itself then print the number is prime.Step-7 Stop

  • 8/8/2019 foc_labmanual

    20/48

    Program: 4

    #include#include

    void main(){

    int num,i=2;

    clrscr();

    printf("Enter the number :");scanf("%d",&num);

    while(i

  • 8/8/2019 foc_labmanual

    21/48

    Output:

    Enter the number :5

    The given number is a prime

  • 8/8/2019 foc_labmanual

    22/48

    Ex.No: 5 Write a simple C program to Generate Fibonacci Series

    Date :

    Aim:

    To write a program to generate the Fibonacci series

    Algorithm:

    Step-1 Start the programStep-2 Enter the number

    Step-3 Check the number whether the number is zero or not. If

    Zero print Zero value. If not zero go further.Step-4 Set a loop up to the given number.

    Step-5 fib=fib+a;

    a=b;b=c;

    Step-6 Every increment in the loop prints the value of fib.

    Step-7 After the execution of the loop stops the program

  • 8/8/2019 foc_labmanual

    23/48

    Program: 5

    #include#include

    void main()

    {

    int num,fib=0,a=0,b=1,i;clrscr();

    printf("Enter the number :");scanf("%d",&num);

    printf("\nFIBONACCI SERIES\n");

    if(num==0)

    printf("0");else

    {

    for(i=0;i

  • 8/8/2019 foc_labmanual

    24/48

    Output:

    Enter the number :5

    FIBONACCI SERIES0

    11

    2

    3

  • 8/8/2019 foc_labmanual

    25/48

    Ex.No: 6 Write a simple C program to find Palindrome or Not

    Date :

    Aim:

    To find sum of Digits, Reverse and the given Number is Palindrome or not.

    Algorithm:

    Step-1 Start the programStep-2 Enter the number

    Step-3 Set a loop upto the number is not equal to zero

    Step-4 Find the digit of the number Step-5 Find the sum of digit

    Step-6 Find the reverse number

    Step-7 After the end of the loop print the sum and reverse number of the digitStep-8 Find whether the reverse number is equal to the given number or not. If

    equal the number is palindrome

    Step-9 If not equal the given number is not palindromeStep-10 Stop

  • 8/8/2019 foc_labmanual

    26/48

    Program: 6

    #include

    main()

    {

    unsigned long int a,num,sum=0,rnum=0,rem;printf(\nEnter the number...);

    scanf(%ld,&num);a=num;

    while(num!=0)

    {

    rem=num%10;sum=sum+rem;

    rnum=rnum*10+rem;

    num=num/10;}

    printf(\nThe sum of the digits of %ld is %ld\n,a,sum);

    printf(\nThe reverse number of the %ld is %ld,a,rnum);if(a==rnum)

    printf(\nThe given number is a palindrome);

    elseprintf(\nThe given number is not a palindrome);

    }

  • 8/8/2019 foc_labmanual

    27/48

    Output:

    Enter the number...12321

    The sum of the digits of 12321 is 9The reverse number of the 12321 is 12321

    The given number is a palindrom

  • 8/8/2019 foc_labmanual

    28/48

    Ex.No: 7 Write a simple C program to find String Length without using library function

    Date :

    Aim: To write a program to find the string length without using String

    function.

    Algorithm:

    Step-1 Start the programStep-2 Enter the string

    Step-3 Find the string length using the function strlen()

    Step-4 Print the string length of the entered stringStep-5 Print the length of the string

    Step-6 Stop

  • 8/8/2019 foc_labmanual

    29/48

    Program: 7

    #include

    #include

    void main()

    { char str[40];

    int len;clrscr();

    printf("Enter the string :");

    scanf("%s",str);

    for(len=0;str[len]!='\0';len++);printf("Length of the string :%d",len);

    getch();

    }

  • 8/8/2019 foc_labmanual

    30/48

    Output:

    Enter the string :madam

    Length of the string :5

  • 8/8/2019 foc_labmanual

    31/48

    Ex.No: 8 Write a simple C program for Matrix Multiplication

    Date :

    Aim:

    To write a program to multiply two matrixes.

    Algorithm:

    Step-1 Start the program

    Step-2 Enter the row and column of the A matrix

    Step-3 Enter the row and column of the B matrix

    Step-4 Enter the elements of the A matrixStep-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 formStep-8 Set a loop up to row

    Step-9 Set a inner loop up to column

    Step-10 Set another inner loop up to columnStep-11 Multiply the A and B matrix and store the element in the C matrix

    Step-12 Print the resultant matrix

    Step-13 Stop

  • 8/8/2019 foc_labmanual

    32/48

    Program: 8

    #include

    #includevoid main()

    {

    int a[25][25],b[25][25],c[25][25],i,j,k,r,s;

    int m,n;clrscr();

    printf("Enter the no.of rows and column of A matrix :");scanf("%d%d",&m,&n);

    printf("\nEnter the no.of rows and column of B matrix :");

    scanf("%d%d",&r,&s);

    if(m!=r)printf("\nThe matrix cannot multiplied");

    else

    {printf("\nEnter the elements of A matrix :\n");

    for(i=0;i

  • 8/8/2019 foc_labmanual

    33/48

    c[i][j]=c[i][j]+a[i][k]*b[k][j];

    printf("\t%d",c[i][j]);

    }}

    }

    getch();}

    Output:

    Enter the no.of rows and column of A matrix :3 3

    Enter the no.of rows and column of B matrix :3 3

    Enter the elements of A matrix :1 2 3 4 5 6 7 8 9

    Enter the elements of B matrix :

    1 2 3 4 5 6 7 8 9

    The multiplication of two matrixes :

    30 36 42

    66 81 96102 126 150

  • 8/8/2019 foc_labmanual

    34/48

    Ex.No: 9 Write a simple C program to arrange the Numbers in ascending order

    Date :

    Aim: To write a program to print the ascending of the given array.

    Algorithm:

    Step-1 Start the program

    Step-2 Enter the size of the arrayStep-3 Enter the elements of the array

    Step-4 Set a loop up to the array size minus one

    Step-5 Set a inner loop up to the size of the arrayStep-6 Check whether the next array element is greater than or

    not

    Step-7 If greater than exchange their positionStep-8 If not greater than then go to the loop

    Step-9 After the execution of the inner loop the outer loop is executed

    Step-10 Print the ascending order of the given arrayStep-11 Stop

  • 8/8/2019 foc_labmanual

    35/48

    Program: 9

    #include

    #include

    void main()

    {

    int i,j,k,n;

    float a[50],temp;clrscr();

    printf("Enter the number how many number you want to sort\n");scanf("%d",&n);

    printf("Enter the %d Element",n);

    for(i=0;i

  • 8/8/2019 foc_labmanual

    36/48

  • 8/8/2019 foc_labmanual

    37/48

    Ex.No: 10 Write a simple C program to find factorial using Recursion function

    Date :

    Aim:

    To write a program to find the factorial of the given number using recursion

    Algorithm:

    Step-1 Start the programStep-2 Enter the number

    Step-3 Call the recursive function passing the number to the recursivefunction

    as an argument.

    Step-4 If the entered number is equal to one then return one to main function.Step-5 If the number is less greater then one then call recursive

    Step-6 Print the factorial value of the number.

    Step-7 Stop

  • 8/8/2019 foc_labmanual

    38/48

    Program: 10

    #include#include

    int rec(int);

    void main()

    { int a;

    clrscr();printf("Enter the number :");

    scanf("%d",&a);

    printf("The factorial of %d = %d",a,rec(a));

    getch();}

    int rec(int x)

    {int f;

    if(x==1)

    return(1);else

    f=x*rec(x-1);

    return(f);}

  • 8/8/2019 foc_labmanual

    39/48

    Output:

    Enter the number :5

    The factorial of 5 = 120

  • 8/8/2019 foc_labmanual

    40/48

  • 8/8/2019 foc_labmanual

    41/48

    Program: 11 a

    #include

    #include

    int cube(int);void main()

    {

    int a;

    clrscr();printf("Enter the value :");

    scanf("%d",&a);printf("The value of cube is %d",cube(a));

    getch();

    }

    int cube(int x){

    int c;

    c=x*x*x;return(c);

    }

  • 8/8/2019 foc_labmanual

    42/48

    Output:

    Enter the value :3

    The value of cube is 27

  • 8/8/2019 foc_labmanual

    43/48

    Ex.No: 11 b Write a simple C program to implement Call by Reference

    Date :

    Aim:

    To write a program to swap two number without using pointer

    Algorithm:

    Step-1 Start the program

    Step-2 Enter the two numbers

    Step-3 Call the display function

    Step-4 Pass the address of the two numbers to the callingfunction

    Step-5 Get the address in the calling function in the pointer

    Step-6 Swap the number using temporary variableStep-7 Print the swamped values in the main function

    Step-8 Stop

  • 8/8/2019 foc_labmanual

    44/48

    Program: 11 b

    #include

    #include

    int swap(int*,int*);

    void main(){

    int a,b;clrscr();

    printf("Enter the value of a and b:");

    scanf("%d%d",&a,&b);

    swap(&a,&b);printf("After swapping a=%d\tb=%d\n",a,b);

    getch();

    }int swap(int *x,int *y)

    {

    int t;t=*x;

    *x=*y;

    *y=t;return(0);

    }

  • 8/8/2019 foc_labmanual

    45/48

    Output:

    Enter the value of a and b:5 10

    After swapping a=10 b=5

  • 8/8/2019 foc_labmanual

    46/48

    Ex.No: 12 Write a C program for Student Detail using Structure

    Date :

    Aim:

    To write a program to print the student name, roll no, average mark and their grades.

    Algorithm:

    Step-1 Start the program

    Step-2 Initialize the structure variable

    Step-3 Enter the number of studentStep-4 Set a loop up to the number of student

    Step-5 Enter the student name, roll no, average marks

    Step-6 Find their gradesStep-7 Print the student name, roll no, average and their grade

    Step-9 Stop

  • 8/8/2019 foc_labmanual

    47/48

    Program: 12

    #include

    main()

    {struct student

    {

    char name[25];

    char regno[25];int avg;

    char grade;} stud[50],*pt;

    int i,no;

    printf(Enter the number of the students...);

    scanf(%d,&no);for(i=0;iavggrade=C;

    else if(pt->avggrade=B;else

    pt->grade=A;

    }

    printf(\n);

  • 8/8/2019 foc_labmanual

    48/48

    printf(NAME REGISTER-NO AVERAGE GRADE\n);

    for(pt=stud;ptname,pt->regno);

    printf(%10d \t %c\n,pt->avg,pt->grade);

    }}

    Output:

    Enter the number of the students

    3student[1] information:

    Enter the name MUNI

    Enter the roll no of the student 100

    Enter the average value of the student 95student[2] information:

    Enter the name LAKEnter the roll no of the student 200

    Enter the average value of the student 55

    student[3] information:

    Enter the name RAJAEnter the roll no of the student 300

    Enter the average value of the student 25

    NAMEREGISTER-NO AVERAGE GRADEMUNI 100 95 A

    LKA 200 55 B

    RAJA 300 25 D