Ticker

6/recent/ticker-posts

CPNM LAB PROGRAM-4

cpnm lab 4 programming made by ece the wonders ***THANK YOU***     
----------------------------------------------
4. Write a program which determines the largest and the smallest number that can be stored in different data types like short, int, long, float, and double. What happens when you add 1 to the largest possible integer number that can be stored?
---------------------------------------
PROGRAM :-

#include <stdio.h>
#include <limits.h>
#include <float.h>

int main()
  printf("The minimum and maximum ranges of short_int data type is ");

  printf("\n---------------------------------------------------------\n");
  
  printf("Minimum value of short_int data type is %d\n",SHRT_MIN);

  printf("Maximum value of short_int data type is %d\n",SHRT_MAX);

  printf("\n");


  printf("The minimum and maximum ranges of integer data type is ");

  printf("\n---------------------------------------------------------\n");
  
  printf("Minimum value of integer data type is %d\n",INT_MIN);

  printf("Maximum value of integer data type is %d\n",INT_MAX);

  printf("\n");


  printf("The minimum and maximum ranges of floating point data type is ");

  printf("\n---------------------------------------------------------\n");
  
  printf("Minimum value of floating point data type is %.2f\n",FLT_MIN);

  printf("Maximum value of floating point data type is %.2f\n",FLT_MAX);

  printf("\n");


  printf("The minimum and maximum ranges of Double data type is ");

  printf("\n---------------------------------------------------------\n");
  
  printf("Minimum value of Double data type is %.2f\n",DBL_MIN);

  printf("Maximum value of Double data type is %.2f\n",DBL_MAX);

  printf("\n");


  printf("The minimum and maximum ranges of Long data type is ");

  printf("\n---------------------------------------------------------\n");
  
  printf("Minimum value of Long data type is %ld\n",LONG_MIN);

  printf("Maximum value of Long data type is %ld\n",LONG_MAX);

  printf("\n");


  printf("The minimum and maximum ranges of character data type is ");

  printf("\n---------------------------------------------------------\n");
  
  printf("Minimum value of character data type is %d\n",CHAR_MIN);

  printf("Maximum value of character data type is %d\n",CHAR_MAX);

  printf("\n");



printf("The minimum and maximum ranges of Unsigned integer data type is ");

  printf("\n---------------------------------------------------------\n");
  
  printf("Minimum value of Unsigned integer data type is %u\n",INT_MIN);

  printf("Maximum value of Unsigned integer data type is %u\n",INT_MAX);

  printf("\n");



  printf("The maximum ranges of Unsigned character and unsigned long data type is ");

  printf("\n---------------------------------------------------------\n");
  
  printf("Maximum value of Unsigned character data type is %d\n",UCHAR_MAX);

  printf("Maximum value of Unsigned long data type is %u\n",ULONG_MAX);

  printf("\n---------------------------------------------------------\n");

  printf("When add 1 to the largest value of int is %d",INT_MAX+1);
  
  return 0;
}


Output:- 


Post a Comment

0 Comments