Preview

Lab Assignment: C Language Program

Good Essays
Open Document
Open Document
1616 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Lab Assignment: C Language Program
R .B.S COLLEGE OF TECHNOLOGY AND MANGEMENT
----------------------------------------------------------------------
AGRA B.C.A FIRST SEMESTER >>>> LAB ASSINGMENT>>>>
---------------------------------------------------------------------------
1- Write a program to compute area and circumference of a circle.
Program-

#include<stdio.h>
#include<conio.h>
Void main()
{
float radius,circumference,area; clrscr(); printf(“the radius of circle= ”); scanf(“%f”,radius); circumference=2*3.14*radius; area=3.14*radius*radius; printf(“the area of circle=%f \n the circumference=%f”,area,circumference); getch(); }

2- Write a program converts a temperature from Celsius to Fahrenheit. Use the following formula: F = 1.8 x C + 32 .
Program-
#include<stdio.h>
#include<conio.h>
void main() float celsius, farenheit; clrscr(); printf(“temperature in celsius= ”); scanf(“%f”,celsius); farenheit=1.8*c+32; printf(“\nthe temp in farenheit=%f”,farenheit); getch(); }

3- Write a complete C Program that prompts the user for the Cartesian Coordinates of two points (x1, y1) and (x2, y2 ) and displays the distance between them computed using the following formula :
Distance =
Program-
#include<stdio.h>
#include<math.h>
#include<conio.h>
Void main()
{
float x1,x2,y1,y2,distance; clrscr(); printf(“the co-ordinates are=”); scanf(“%f %f %f %f”, &x1,&x2,&y1,&y2); distance=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)); printf(“distance=%f”,distance); getch(); }
4. Write a program that reads the lengths of two sides of a triangle and the angle between them and calculates the length of the third side using the following formula: Program-
#include<stdio.h>
#include<math.h>
#include<conio.h>
Void main()
{
float side1,side2 ,side3,angle;
clrscr();

You May Also Find These Documents Helpful

Related Topics