Computer Programming
Computer Programming
STUDY OF OS COMMANDS
Aim: To study MS-DOS commands for performing Character User Interface (CUI) operations in Files
and Directories.
Procedure:
1. Go to START → RUN and type ‘Cmd’ and click ok button. The command prompt window will
open.
2. The default directory location is C:\Documents and Settings\Username> ,now change the
prompt like C:\> D:
3. Type the following commands in the prompt D:\> to see the result
1. DIR:
This command is used to display the files and directories of the current drive and directory.
Example:
D:\> DIR
D:\> DIR /P
D:\> DIR /W
D:\> DIR /AH
Page | 1
2. MD [MAKE DIRECTORY]:
Where drive is the floppy \ hard disk drive on which you want to create a new directory.
Example:
D:\> MD Christ
D:\> DIR /P
3. CD [CHANGE DIRECTORY]:
D:\> CD CCET
D:\CCET>
D:\> CD..
D:\>
4. RD [REMOVE DIRECTORY]:
This command is used to remove the directory.
Syntax: RD [directory]
D:\> RD CCET
D:\> DIR /P
Page | 2
FILE RELATED COMMANDS:
1. COPY CON COMMAND :
Example:
2. TYPE COMMAND:
3. COPY COMMAND:
4. REN COMMAND:
Example:
5. DEL COMMAND:
Page | 3
Example:
D:\>DEL college
6. CLS COMMAND:
CLS is a command that allows a user to clear the complete contents of the screen and
leave only the prompt.
Syntax: CLS
Example:
D:\> CLS
7. TIME COMMAND:
Example:
D:\> TIME
8. DATE COMMAND:
Example:
D:\> DATE
9. EDIT COMMAND:
This command is used to change or edit the content of the given file.
To Save file - Ctrl+F+S
To Exit file - Alt + X
SCREEN SHOT:
Page | 4
RESULT:
Thus the given MS DOS directory related and file related commands have been
studied and executed successfully.
Page | 5
Ex:No:2 : Write a c program to find the area of a triangle
AIM :
Area = √(s*(s-a)*(s-b)*(s-c))
Where s = (a + b + c)/2
ALGORITHM:
Step 1 : start
Step 2 : Declare the variable a, b, c, s, area
Step 3 : Get the value of a, b, c
Step 4 : Find s value s=(a+b+c)/2
Step 5 : Find area = sqrt(s*(s-a)*(s-b)*(s-c))
Step 6 : Print the value of area
Step 7 : Stop
FLOW CHART :
START
Read a,b,c
s=(a+b+c)/2
area = sqrt(s*(s-a)*(s-b)*(s-c))
PRINT area
STOP
Page | 6
SOURCE CODE :
#include<stdio.h>
#include<math.h>
#include<conio.h>
void main()
{
float a,b,c;
float s,area;
clrscr();
printf("Enter size of each sides of triangle");
scanf("%f%f%f",&a,&b,&c);
s = (a+b+c)/2;
area = sqrt(s*(s-a)*(s-b)*(s-c));
printf("Area of triangle is: %.3f",area);
getch();
}
Page | 7
SCREEN SHOT:
RESULT:
Thus the given program to calculate area of a triangle has been executed and verified
successfully.
Page | 8