Practical - 2: Que. Why CLRSCR and Getch Are Been Used Here? Que
Practical - 2: Que. Why CLRSCR and Getch Are Been Used Here? Que
PRACTICAL - 2
GENERAL INSTRUCTIONS Do the following. 1. Make a new file named FILENAME.C in the directory named G:\ stN \ set2. (Make a new directory of the given name if required.) FILENAME = name of the program, N in stN = your login number. 2. Enter the program given below. 3. Save the file. 4. Understand the logic of the program. 5.Compile the program. Check for the errors. Remove the errors (if any). And compile again. (See the message about linking process in the message window.) 6. Run the program. 7. See the output 8. Write your comments on the program as well as errors and output. INSTRUCTIONS FOR PROGRAM 3 Answer thefollowing questions.
Que. Why clrscr() and getch() are been used here? Que. What is the need of conio.h file?
PROGRAM 1 \* Program to print given message on the screen. #include <stdio.h> void main () { printf(Welcome to DDIT); getch(); } *\
PROGRAM 2
\* Program to calculate the area of a circle. Input - Radius of the circle. Output Area of the circle. *\
#include<stdio.h>
#define pi 3.14159 void main() { int radius; float area; printf(Radius = ? ); scanf(%f, &radius); area = pi * radius * radius printf(\nArea of the circle = %f, area); }
COMPUTER PROGRAMMING C PROGRAMS SET1
\*Declaration*\
PROGRAM 3
\* Program to calculate the Net Salary. Input - Gross Salary Output - Net Salary. *\ #include <stdio.h> #include<conio.h>
void main() {
float tax, net,gross; printf(Gross Salary: ); scanf(%d, &gross); tax = 0.1415 * gross; net = gross tax; printf(/nNet Salary: %f, net); getch(); } \* Decleration *\ \*Input Prompt*\
\* Data Manipulation*\
\* Output *\