C Programming - Floating Point Issues - Discussion
Discussion Forum : Floating Point Issues - General Questions (Q.No. 5)
5.
Which statement will you add in the following program to work it correctly?
#include<stdio.h>
int main()
{
printf("%f\n", log(36.0));
return 0;
}
Answer: Option
Explanation:
math.h is a header file in the standard library of C programming language designed for basic mathematical operations.
Declaration syntax: double log(double);
Discussion:
14 comments Page 1 of 2.
Aadhiii said:
6 years ago
@Satti.
#include<stdio.h>
main()
{
int a,b,c;
a=32767;
b=32768;
c=32769;
printf("a=%d,b=%d,c=%d",a,b,c);
}
Output is
a=32767
b=-32768
c=-32769 this type of output is in book
But;
My output is;
a=32767
b=32768
c=32769
The '-' minus sign is not find how? Please explain this.
#include<stdio.h>
main()
{
int a,b,c;
a=32767;
b=32768;
c=32769;
printf("a=%d,b=%d,c=%d",a,b,c);
}
Output is
a=32767
b=-32768
c=-32769 this type of output is in book
But;
My output is;
a=32767
b=32768
c=32769
The '-' minus sign is not find how? Please explain this.
Rajat Bhise said:
7 years ago
@Satti.
#include<stdio.h>
main()
{
int a,b,c;
a=32767;
b=32768;
c=32769;
printf("a=%d,b=%d,c=%d",a,b,c);
}
Output is
a=32767
b=-32768
c=-32769 this type of output is in book
But;
My output is;
a=32767
b=32768
c=32769
The '-' minus sign is not find how? Please explain this.
#include<stdio.h>
main()
{
int a,b,c;
a=32767;
b=32768;
c=32769;
printf("a=%d,b=%d,c=%d",a,b,c);
}
Output is
a=32767
b=-32768
c=-32769 this type of output is in book
But;
My output is;
a=32767
b=32768
c=32769
The '-' minus sign is not find how? Please explain this.
Muhammed shafeek kp said:
9 years ago
#include<stdio.h>
int main()
{
printf("%f\n", log(36.0));
return 0;
}
What is the output of this program?
Can I run this program by using #include<conio.h>?
int main()
{
printf("%f\n", log(36.0));
return 0;
}
What is the output of this program?
Can I run this program by using #include<conio.h>?
Mallikarjun said:
1 decade ago
float 3.12;
{
scanf("2.1%f",&a);
}
Output? And in this program what is 2.1%f?
Please explain who know about this?
{
scanf("2.1%f",&a);
}
Output? And in this program what is 2.1%f?
Please explain who know about this?
Suyoj said:
1 decade ago
What is the difference between getch and getche ?
Deepa said:
1 decade ago
What are the different b/w stdio, conio, stdlib? could any one?
Satti said:
1 decade ago
Range of signed integer is -32768 to 32767
but in unsigned integer case range is 65535
ie) 32768=-32768
32769=-32767
32770=-32766
.
.
.
65535=-1
thats why processor prints -1.
in ur second quetn j=-2
but i=1+j so i=-1; so the output prints 65535
but in unsigned integer case range is 65535
ie) 32768=-32768
32769=-32767
32770=-32766
.
.
.
65535=-1
thats why processor prints -1.
in ur second quetn j=-2
but i=1+j so i=-1; so the output prints 65535
Pratap Singh said:
1 decade ago
unsigned int i=65535;
int j;
j=i;
printf("%d",j);
output
-1 //// Why the output of j=-1 ....Please explain this
int j=-2;
unsigned int i=1+j;
printf("%u",i);
output
65535 //// Wht the output of i=65535
int j;
j=i;
printf("%d",j);
output
-1 //// Why the output of j=-1 ....Please explain this
int j=-2;
unsigned int i=1+j;
printf("%u",i);
output
65535 //// Wht the output of i=65535
Hajmaldeen said:
1 decade ago
How to run this program to unix?
Devendra said:
1 decade ago
If we use stdio.h,ans. is -.000901 and using math.h ans is -.001263
Why is it different?
Why is it different?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers