WordPress.com



INTRODUCTION TO COMPUTERS & PROGRAMMING IN C

PRACTICAL FILE

SUBMITTED TO: PREPARED BY:

Ms. Parul Bhatia Kalra RAVITEJ SINGH REKHI

SECTION: 2-ECE 2

ENROLL NO: A2305113100

AMITY SCHOOL OF ENGINEERING AND TECHNOLOGY

AMITY UNIVERSITY CAMPUS, SECTOR-125, NOIDA-201303

|Experiment No.|Name of Experiment |Date of allotment |Date of Evaluation |Max. Marks |Marks obtained |Sign |

| | |of experiment | | | | |

|1 | | | | | | |

|2 | | | | | | |

|3 | | | | | | |

|4 | | | | | | |

|5 | | | | | | |

|6 | | | | | | |

|7 | | | | | | |

|8 | | | | | | |

|9 | | | | | | |

|10 | | | | | | |

INDEX

EXPERIMENT 1

DATE: 16/12/13

OBJECTIVE: Write a program to find the sum of two numbers. Calculate the average of number.

SOFTWARE USED: Turbo C

PROCEDURE:

#include

#include

void main()

{

clrscr();

float a,b;

printf("Enter First number: ");scanf("%f",&a);

printf("Enter Second number : ");scanf("%f",&b);

printf("The sum of the numbers is : %fm",a+b);

printf("\nThe average of numbers is : %f",(a+b)/2);

getch();

}

OBSERVATIONS AND DISCUSSIONS:

1)C Language supports arithmetic operators like addition, division etc. as used above.

2)Format specifier for float is %f.

3)printf() function is used to print the “character, string, float, integer, octal and hexadecimal values” onto the output screen.

scanf() function is used to read character, string, numeric data from keyboard.

4)To generate a newline,we use “\n” in C printf() statement.

5)stdio.h: Most of the C input/output functions are defined in stdio.h

conio.h: is a C header file used in MS-DOS compilers for performing "console input and output " from a program.

OUTPUT:

[pic]

CONCLUSIONS:

The program shows the sum of 2 numbers and their average by using arithmetic operators.

SIGNATURE:

EXPERIMENT 2

DATE: 23/12/13

OBJECTIVE: Write a program to find a area of triangle using hero’s formula.

SOFTWARE USED: Turbo C

PROCEDURE:

#include

#include

#include

void main()

{

clrscr();

float e,a,b,c,d,s;

printf("Enter sides of triangle :\n");

printf("Side a = ");scanf("%f",&a);

printf("Side b = ");scanf("%f",&b);

printf("Side c = ");scanf("%f",&c);

s=(a+b+c)/2;

d=s*(s-a)*(s-b)*(s-c);

e=sqrt(d);

printf("\nArea of triangle is %f",e);

getch();

OBSERVATIONS AND DISCUSSIONS:

1)C Language supports arithmetic operators like addition, division etc. as used above.

2)Format specifier for float is %f.

3)Values can be declared while initializing.

4)printf() function is used to print the “character, string, float, integer, octal and hexadecimal values” onto the output screen.

scanf() function is used to read character, string, numeric data from keyboard.

5)To generate a newline,we use “\n” in C printf() statement.

6)stdio.h: Most of the C input/output functions are defined in stdio.h

math.h, it provides many useful functions such as cos,sin...,log,mod,pow etc.

OUTPUT:

[pic]

CONCLUSION:

The program shows the area of triangle by using arithmetic operators and functions use in maths like sqrt etc., defined in math.h.

SIGNATURE:

EXPERIMENT 3

DATE: 6/1/14

OBJECTIVE: Write a program to check number is prime or not.

SOFTWARE USED: Turbo C

PROCEDURE:

#include

#include

void main()

{

clrscr();

int a,i,j,k=0;

printf("\nEnter a number to check whether it is prime or composite : ");

scanf("%d",&a);

j=a-1;

for (i=2;i ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download