0% found this document useful (0 votes)
17 views

Practical - 2: Que. Why CLRSCR and Getch Are Been Used Here? Que

The document provides instructions and sample C programs for students. It includes general instructions for creating and compiling C programs. It then provides 3 short sample C programs with explanations: 1) A program to print "Welcome to DDIT" on the screen. 2) A program to calculate the area of a circle given the radius. 3) A program to calculate net salary given the gross salary. It asks questions about the functions clrscr() and getch() used in the programs and the need for the conio.h header file.

Uploaded by

Chirag Patel
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Practical - 2: Que. Why CLRSCR and Getch Are Been Used Here? Que

The document provides instructions and sample C programs for students. It includes general instructions for creating and compiling C programs. It then provides 3 short sample C programs with explanations: 1) A program to print "Welcome to DDIT" on the screen. 2) A program to calculate the area of a circle given the radius. 3) A program to calculate net salary given the gross salary. It asks questions about the functions clrscr() and getch() used in the programs and the need for the conio.h header file.

Uploaded by

Chirag Patel
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

DHARAMSINH DESAI INSTITUTE OF TECHNOLOGY, NADIAD DEEMED UNIVERSITY

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(); } *\

\* Preprocessor Directive*\ \* Main Function*\ \*Function Defination*\

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*\

\* Output to the Screen*\

DHARAMSINH DESAI INSTITUTE OF TECHNOLOGY, NADIAD DEEMED UNIVERSITY

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 *\

COMPUTER PROGRAMMING C PROGRAMS SET1

You might also like