Académique Documents
Professionnel Documents
Culture Documents
Program no.10 W.A.P. to display pyramid of stars SOLUTION:clear ?"program to display starpyramid" ?replicate('-',20) input"Enter number of rows required"to row_num for line_count=1 to row_num for space_count=row_num to line_count step(-1) ??" " endfor for star_count= 1 to (2*line_count-1) ??"*" endfor ?"" endfor
- 44 -
- 45 -
Program no.12 W.A.P whether a character is vowel or not. SOLUTION:Clear set talk off ? "The current date is", date (), " Time", time () ? "The Program to check whether a character is vowel or not" ? Replicate ('--, 20) Accept "Enter the character" to ch Do Case Case ch = 'a' ? "The Character Entered is vowel" Case ch = 'A' ? "The Character Entered is vowel" Case ch = 'e' ? "The Character Entered is vowel" Case ch = 'E' ? "The Character Entered is vowel" Case ch = 'i' ? "The Character Entered is vowel" Case ch = 'I' ? "The Character Entered is vowel" Case ch = 'o' ? "The Character Entered is vowel" Case ch = '0' ? "The Character Entered is vowel" Case ch = 'u'
- 46 -
Case ch = 'U' ? "The Character Entered is vowel" Otherwise ? "The Character Entered is a consonant" Endcase
- 47 -
Program No.13W.A.P to find fibonacci series. SOLUTION:clear ?"Prog to find fibonacci series" ?replicate('-',25) fir=0 se=1 input"Enter the limit" to n ?fir ?se for i=1 to n step(1) b=fir+se fir=se se=b ?b Endfor
- 48 -
Program No.14 W.A.P to find the average of numbers. SOLUTION:clear ?"Prog to find avg" ?replicate('-',25) sum=0 input"Enter limit" to n for i=1 to n input"Enter no" to num sum=sum+num endfor AVG=sum/n ?"Average is",AVG
- 49 -
Percentage above or equal to 70 A grade Percentage between 50 to 69 B grade Percentage between 40 to 49 c grade Percentage equal or below 40 Fail.
SOLUTION:-
clear ?"program to give grades to students" ?replicate('-',25) input" enter the marks" to num if(num>= 70) ?"A grade" else if(num<=69) if(num>=50) ?"B grade" else if(num<=49) if(num>=40) ?"C grade" endif endif endif endif if(num<40)
- 50 -
- 51 -
PRACTICAL NO :-5
AIM:- INTRODUCTION TO MICROSOFT EXCEL THEORY:Microsoft Excel is allows you to create professional spreadsheets and charts. It performs numerous functions and formulas to assist you in your projects.
Starting Microsoft Excel:Two Ways:1.Double click on the Microsoft Excel icon on the desktop.
- 52 -
Creating Formulas:1.Click the cell that you want to enter the formula. Type = (an equal sign). 2.Click the Function Button 3.Select the formula you want and step through the on-screen instructions
Precedence 1 2 2 3 3 4 5 5 5
Operation Exponentiation Multiplication Division Addition Subtraction Concatenation Equal To Greater Than Less Than
Adding Borders and Shading to Cells:1.Make sure you have the Formatting toolbar visible Click on View --> Toolbars --> Formatting 2.Select cells you wish to format by left clicking on them and highlighting them 3.Click the button to shade a cell and/or the
- 53 -
Inserting A Chart:1.Select over the text you want to make your chart with
- 54 -
5.Select if you want to put it into the current worksheet or into a new worksheet.
- 55 -
PRACTICAL NO :-6
AIM: INTRODUCTION TO COBOL. THOERY
COBOL is a high-level programming language first developed by the CODASYL Committee (Conference on Data Systems Languages) in 1960. Since then, responsibility for developing new COBOL standards has been assumed by the American National Standards Institute (ANSI). The word COBOL is an acronym that stands for Common Business Oriented Language. As the expanded acronym indicates, COBOL is designed for developing business, typically fileoriented, applications. It is not designed for writing systems programs. For instance you would not develop an operating system or a compiler using COBOL.
COBOL is simple:COBOL is a simple language (no pointers, no user defined functions, no user defined types) with a limited scope of function. It encourages a simple straightforward programming style. Curiously enough though, despite its limitations, COBOL has proven itself to be well suited to its targeted problem domain (business computing).
The structure of COBOL programs:COBOL programs are hierarchical in structure. Each element of the hierarchy consists of one or more subordinate elements. We can represent the COBOL hierarchy using the COBOL met language as follows;
- 56 -
Divisions:A division is a block of code, usually containing one or more sections, that starts where the division name is encountered and ends with the beginning of the next division or with the end of the program text.
Sections:A section is a block of code usually containing one or more paragraphs. A section begins with the section name and ends where the next section name is encountered or where the program text ends. Section names are devised by the programmer, or defined by the language. A section name is followed by the word SECTION and a period. See the two example names below SelectUnpaidBills SECTION. FILE SECTION.
Paragraphs:A paragraph is a block of code made up of one or more sentences. A paragraph begins with the paragraph name and ends with the next paragraph or section name or the end of the program text. A paragraph name is devised by the programmer or defined by the language, and is followed by a period. See the two example names below PrintFinalTotals. PROGRAM-ID.
Sentences and statements:A sentence consists of one or more statements and is terminated by a period. For example: MOVE .21 TO VatRate MOVE 1235.76 TO ProductCost COMPUTE VatAmount = ProductCost * VatRate.
- 57 -
PRACTICAL NO. 7
AIM:-TO STUDY VARIOUS PROGRAMS OF COBOL. Programs:1. Write a program to display the string.
Sol:- IDENTIFICATION DIVISION. PROGRAM-ID. HELLO PROCEDURE. DIVISION. DISPLAY savita STOP RUN. OUTPUT:-
- 58 -
- 59 -
- 60 -
4. Write a program to multiply two numbers Sol:IDENTIFICATION DIVISION. PROGRAM-ID. FIRST. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 A PICTURE 99 VALUE IS 10. 01 B PICTURE 99 VALUE IS 10. 01 C PICTURE 999 VALUE IS 0. PROCEDURE DIVISION. A-PARA. DISPLAY " A= ", A. DISPLAY " B= ", B. MULTIPLY A BY B GIVING C. DISPLAY " C= ", C. STOP RUN.
- 61 -
- 62 -
6. Write a program to demonstrate picture and value clause Sol:IDENTIFICATION DIVISION. PROGRAM-ID. DEMONSTRATE PICTURE CLAUSE. AUTHOR. XXXXXXX ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 A PIC 99 VALUE 77. PROCEDURE DIVISION. M-PARA. DISPLAY "A=", A. STOP RUN.
- 63 -
- 64 -