Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

C Programming

185151Computer Practice I

Ex. No. 3C PROGRAMMING


C is a powerful, portable and elegantly structured programming language. It combines features of a high-level language with the elements of an assembler and therefore, suitable for writing both system software and application packages. It is the most widely used generalpurpose language today. C has been used for implementing systems such as operating systems, compilers, linkers, word processors and utility packages. It is a robust language whose rich set of built-in functions and operators can be used to write any complex program. Programs written in C are fast and efficient.

Turbo C IDE Turbo C IDE facilitates editing, debugging and execution of applications written in C. C programs are saved with .c extension. Some of the shortcut keys are: Ctrl + F1 F2 F3 Copy Cut Paste Clear Help Save Open Ctrl + Ins Shift + Del Shift + Ins Ctrl + Del Alt + F9 Ctrl + F9 Alt + F5 F7 Alt + F3 Alt + X Compile Execute User Screen Trace Into Close Quit

cseannauniv.blogspot.com

S.K. Vijai Anand

C Programming

185151Computer Practice I

Ex. No. 3.1AREA OF A CIRCLE


Aim
To write a program to compute the area and circumference of a circle.

Algorithm
Step 1 : Step 2 : Step 3 : Step 4 : Step 5 : Step 6 : Step 7 : Start Define constant pi = 3.14 Read the value of radius Calculate area using formulae pi*radius2 Calculate circumference using formulae 2*pi*radius Print area and circumference Stop

Flowchart

Start

pi = 3.14

Read radius area = pi * radius2 circumference = 2 * pi * radius Print area, circumference

Stop

cseannauniv.blogspot.com

S.K. Vijai Anand

C Programming

185151Computer Practice I

Program
/* Area and circumference of a circle */ #include <stdio.h> #include <conio.h> #define pi 3.14 main() { int radius; float area, circum; clrscr(); printf("\nEnter radius of the circle : "); scanf("%d",&radius); area = pi * radius * radius; circum = 2 * pi * radius; printf("\nArea is %.2f and circumference is %.2f\n",area,circum); getch(); }

Output
Enter radius of the circle : 8 Area is 200.96 and circumference is 50.24

cseannauniv.blogspot.com

S.K. Vijai Anand

You might also like