LAB REPORT

July 14, 2017 | Author: Ferdous Opu | Category: Computer Standards, Computer Libraries, Computer Architecture, Notation, Computer Programming
Share Embed Donate


Short Description

Computer...

Description

1. WAP to find the area of a rectangle #include void main() { float a,b,avg; printf("Enter the numbers :\n"); scanf("%f%f",&a,&b); avg = (a+b)/2; printf("Average of numbers:%f",avg); getch(); }

2. WAP to find the area of a Circle #include void main() { float r,C; printf("Enter Radious value:\n"); scanf("%f", &r); C=3.1416*r*r; printf("Result=%f\n",C); getch(); }

3. WAP to find the area of a triangle #include #include void main() { float a,b,c; float s,area; printf("Enter size of each sides of triangle"); scanf("%f%f%f",&a,&b,&c); s = (a+b+c)/2; area = sqrt(s*(s-a)*(s-b)*(s-c)); printf("Area of triangle is: %f",area); getch(); }

4. Wap to print the last digit of number #include void main(void) { int a,b; printf("\nEnter an integer number:"); scanf("%d",&a); b=a%10; printf("\n\nThe last digit of the integer number is = %d\n",b); getch(); }

5. Wap to print the first digit of a three digit number #include void main(void) { int a,c; printf("\nEnter a three digit integer :"); scanf("%d",&a); c=(a/10)/10; printf("\n\nThe first digit of the three integer number is = %d\n",c); getch(); }

6. Wap to convert a temperature in centigrade into Fahrenheit #include void main () { int F,C; printf("Enter the value of C:\n"); scanf("%d", &C); F=(1.8*C)+32; printf("Result:%d",F); getch(); }

7. Wap to convert a temperature in Fahrenheit into centigrade #include void main() { float c,f; printf("Enter the value of temp in fahrenheit:\n"); scanf("%f", &f); c= (f-32)*5/9; printf(" temp in celsius:%f",c); getch(); }

8. Wap to convert a temperature in kilogram into gram #include void main() { float grams, kilograms; printf("Enter the value in kilograms:\n"); scanf("%f", &kilograms); grams=kilograms*1000; printf("Result=%f\n",grams); getch(); }

9. Wap to print the Average of two number #include void main() { float a,b,avg; printf("Enter the numbers :\n"); scanf("%f%f",&a,&b); avg = (a+b)/2; printf("Average of numbers:%f",avg); getch(); }

10. Wap to print the sum of three numbers #include void main() { float a,b,c,d; printf("Enter three numbers to add\n"); scanf("%f%f%f",&a,&b, &c); d=a+b+c; printf("Sum of entered numbers = %f\n",d); getch(); }

#include void main(){ float a,b,c,d,e,x,y; printf("Enter your numbers="); scanf("%f%f%f%f%f",&a,&b,&c,&d,&e); x=(a+b+c+d+e)/5; y=x/2; printf("\nresult= %.2f\n",y); getch(); }

#include void main(){ float E,x,y,z; printf(" x="); scanf("%f",&x); printf("y="); scanf("%f",&y); printf("z="); scanf("%f",&z); E=2*x*x*x+4*y*y+3*z; printf("\nf(x)=%.2f\n",E); getch(); }

#include void main() { printf("Hello World\n"); printf("I Love my Country\n"); getch(); }

#include void main() { printf("Hello World\n"); printf("I am learning C\n"); printf("One day\n"); printf("I will be expert in programming\n"); getch(); }

#include void main (){ printf("Hello World\n"); printf("I am learning C\n"); printf("One day I will be expert in programming\n "); getch(); }

View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF