Write a program that calls a function to scale a real number

Write a program that calls a function to scale a real number x into its scientific notation so that 1 lessthanorequalto x

Solution

Answer:

#include<stdio.h>

#include<conio.h>

#include<string.h>

void notation(float *a,int *n)

{

int k;

k=*a;

if(k>0)

{

if((*a>10)&&(*a<100))

{

*a=*a/10;

*n=1;

//cout<<a;

}

else

if((*a>=100)&&(*a<1000))

{

*a=*a/100;

*n=2;

}

else

if((*a>=1000)&&(*a<10000))

{

*a=*a/1000;

*n=3;

}

printf(\"x=%f\ \ n=%d\",*a,*n);

}

else

if(k==0)

{

if((0.10<*a)&&(0.100<*a))

{

*a=*a*10;

*n=1;

}

else

if((0.100<*a)&&(0.1000<*a))

{

*a=*a*100;

*n=2;

}

printf(\"\ \ x=%f\ \ n=%d\",*a,*n);

}

}

void main()

{

clrscr();

int n=0;

float a;

printf(\"enter a no.\");

scanf(\"%f\",&a);

notation(&a,&n);

getch();

}

 Write a program that calls a function to scale a real number x into its scientific notation so that 1 lessthanorequalto x SolutionAnswer: #include<stdio.h&g
 Write a program that calls a function to scale a real number x into its scientific notation so that 1 lessthanorequalto x SolutionAnswer: #include<stdio.h&g

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site