Assingment 1-Sme 1013 Exercise 1 Answer
Assingment 1-Sme 1013 Exercise 1 Answer
h> main () { int b, e, i, j, k, l; float a, c, d, f, g, h; Display value on the screen a=0.5; printf("a = %f \n\n", a); This floating-point constant is valid.. Display value on the screen This decimal integer constant is invalid because illegal character (,) Answer
Display value on the screen f = .9; printf("f = %f \n\n", f); This floating-point constant is valid.
This floating-point constant is invalid because exponents must be an integer quantity (it cant contain a decimal point).
This floating-point constant are invalid because illegal character (blank space) in the exponent.
This numerical values are invalid because illegal character (8), ( 8 is not in the octal integer constant). This numerical values are invalid because illegal character (G), ( G is not in the Hexadecimal integer constant).
This numerical values are invalid because illegal character (h), (h is not in the Hexadecimal integer constant).
int i=8, j=5; float x=0.005, y=-0.01; char d='d'; x + y; printf("x + y = %f \n\n", x + y);
Exercise 3 /*My Program start here*/ #include<stdio.h> #include<math.h> main() { int i=8, j=5; float x=0.005, y=-0.01; abs(i-2*j); printf("abs(i-2*j) = %d\n\n\n", abs(i-2*j)); Answer
fabs(x+y); printf("fabs(x+y) = %f\n\n\n", fabs(x+y)); ceil(x+y); printf("ceil(x+y)= %f\n\n\n", ceil(x+y)); floor(x); printf("floor(x) = %f\n\n\n",floor(x)); sqrt(x*x + y*y); printf("sqrt(x*x + y*y) = %f\n\n\n", sqrt(x*x + y*y)); log(x); printf("log(x) = %f\n\n\n", log(x)); pow(x-y,3.0); printf("pow(x-y,3.0) = %f\n\n\n", pow(xy,3.0)); sin(x-y); printf("sin(x-y) = %f\n\n\n", sin(x-y)); }