//Program to print the range of data types in c
#include<stdio.h>
#include<conio.h>
#include<limits.h>
int main()
{
clrscr();
printf("int %%d %d %d to %d",
sizeof(int),INT_MIN,INT_MAX);
printf("\nchar %%d %d %d to %d",
sizeof(char),CHAR_MIN,CHAR_MAX);
printf("\nlong %%d %d %d to %d",
sizeof(long),LONG_MIN,LONG_MAX);
printf("\nshort char %%d %d %d to %d",
sizeof(short char),SCHAR_MIN,SCHAR_MAX);
printf("\nint %%d %d %d to %d",
sizeof(short),SHRT_MIN,SHRT_MAX);
getch();
return 0;
}
#include<stdio.h>
#include<conio.h>
#include<limits.h>
int main()
{
clrscr();
printf("int %%d %d %d to %d",
sizeof(int),INT_MIN,INT_MAX);
printf("\nchar %%d %d %d to %d",
sizeof(char),CHAR_MIN,CHAR_MAX);
printf("\nlong %%d %d %d to %d",
sizeof(long),LONG_MIN,LONG_MAX);
printf("\nshort char %%d %d %d to %d",
sizeof(short char),SCHAR_MIN,SCHAR_MAX);
printf("\nint %%d %d %d to %d",
sizeof(short),SHRT_MIN,SHRT_MAX);
getch();
return 0;
}
what about the unsigned int, float, char..etc how to print there range...??
ReplyDeleteThank you!! much needed..
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDeletefor float we need to include other headerfile: float.h
ReplyDeletefor minimum float value: FLT_MIN
for maximum float value: FLT_MAX
example:
#include"stdio.h"
#include"float.h"
int main()
{
printf("Minimum value for float is: %e", FLT_MIN);
printf("Maximum value for float is: %e", FLT_MAX);
return 0;
}
for float we need to include other headerfile: float.h
ReplyDeletefor minimum float value: FLT_MIN
for maximum float value: FLT_MAX
example:
#include"stdio.h"
#include"float.h"
int main()
{
printf("Minimum value for float is: %e", FLT_MIN);
printf("Maximum value for float is: %e", FLT_MAX);
return 0;
}
for double & long double range
DeleteProgram is not working.
ReplyDelete