Write a C program to get the maximum and minimum values of a Data type

Posted by Tushar Bedekar

#include(stdio.h)                                     // note place '<' & '>' in place of '(' & ')'
#include(conio.h) 
void main( )
{
int x, y;
clrscr( );
x=1;  
while( x > 0)
{
y = x;
x + + ;
}
printf("\nMaximum value : %d ", y );
printf("\nMinimum value : %d", x);
getch( );
}

Output:- Maximum value : 32767
Minimum value : -32768

Similarly we can find the below datatypes,
long int ( %ld ) 
char ( %d ) 
unsigned ( %u )
.....

0 comments:

Post a comment

back to top