CBNST Lab
CBNST Lab
UNIVERSITY,
DEHRADUN
B. Tech CSE
Section: H2
Roll No: 50
DEPARTMENT OF B.Tech (CSE)
STUDENT LAB REPORT SHEET
Photograp
Name of Student ……………………………………….……. Mob.No……………………………….…………..
h Passport
Address Permanent ………………………………………………………………………………………….……….. Size
Father’s Name ………………………… Occupation …………………………… M.No……..…….….………
Mother’s Name …………………….. Occupation…………………………… M.No…………….…………..
Section ………… Branch…………………… Semester……………. Class Roll No...................Grade A B C
Local Address……………………………………………… Email.................................................Marks 5 3 1
12
13
14
S.N Practical D.O.P. Date of Grade Grade Total Student’s Teacher’s
o. Submiss (Viva) (Report Marks Signature Signature
ion File) (out of
10)
15
16
17
18
19
20
Bahuguna Roll
Number: 02 Section:
C2
Aim- To demonstrate the use of 10 mathematical functions from the ‘math.h’ library in C.
Algorithm: -
•Initialize variables:
➢ number to 16.0
➢ base to 2.0
➢ exponent to 3.0
1.Square root:
➢ Print result
2.Power:
➢ Print result
3.Sine:
➢ Print result
4.Cosine:
➢ Print result
5.Tangent:
➢ Print result
➢ Print result
8.Exponential:
➢ Print result
9.Absolute value:
➢ Print result
➢ Print result
Code: -
#include
<stdio.h>
#include
<math.h>
#ifndef M_PI
#endif
int main() {
pow(base, exponent));
number, exp(number));
fabs(negative_number));
sinh(angle)); return 0;
Output: -
Program
2
Name: Abhay
Bahuguna Roll
Number: 02 Section:
C2
Program 2.1
Aim- To deduce an error (Absolute error, Relative error, Percentage error) in a given
problem. Algorithm
Code:
#include
<stdio.h>
#include
<math.h> int
main(){
double appxValue =
1.414; double
trueValue;
"); scanf("%lf",
&trueValue);
relError * 100.0;
Output:
Name: Abhay
Bahuguna Roll
Number: 02 Section:
C2
Program 2.2
Aim- Approximate value of 1/3 is 0.30, 0.33, 0.34 find the best approxima on
Algorithm:
•Calculate Absolute error for each approximate value and print them
•Select the approximate value with lowest absolute error as best approximate value
Code:
#include<stdio
.h>
#include<math.
double
appxValue1,appxValue2,appxValue3;
"); scanf("%lf",
&appxValue1);
");
scanf("%lf", &appxValue2);
scanf("%lf", &appxValue3);
absError1,miniElement = appxValue1;
if(absError1 > absError2){
mini = absError2;
miniElement =
appxValue2;
miniElement =
appxValue3;
Output: