-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ff97988
commit b139506
Showing
1 changed file
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# include<stdio.h> | ||
|
||
|
||
int main() { | ||
|
||
float var1 = 3.1415926535897932; | ||
double var2 = 3.1415926535897932; | ||
long double var3 = 3.14159265358979323846264338327950288; //if it's not work on your pc don't panic , it's may be system problem | ||
|
||
printf("float: %.20f\n", var1); | ||
printf("double: %.20lf\n", var2); | ||
printf("long double: %.20Lf\n", var3); //if it's not work on your pc don't panic , it's may be system problem | ||
|
||
|
||
printf("%d\n",sizeof(float)); | ||
|
||
printf("%d\n",sizeof(double)); | ||
|
||
printf("%d\n",sizeof(long double)); | ||
|
||
Float -> 4 bytes = 32 bits | ||
|
||
Double -> 8 bytes = 64 bits | ||
|
||
Long Double -> 16 bytes = 128 bits | ||
|
||
//Size of these data types totally depends from system to system. | ||
|
||
int var = 4/9; | ||
printf("%d\n", var); | ||
|
||
float var1 = 4/9; | ||
printf("%f\n", var1); | ||
|
||
float var2 = 4.0/9.0; | ||
printf("%f\n", var2); | ||
|
||
|
||
return 0 ; | ||
|
||
} | ||
|