Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.97 KB | None | 0 0
  1. /* Coded By Sumit...! */
  2.  
  3. #include <stdio.h>
  4. #include <limits.h>
  5. #include <string.h>
  6. #include <conio.h>
  7.  
  8. void main()
  9. {
  10.     char str[100] = {0};
  11.     clrscr();
  12.  
  13.     printf("Enter datatype: ");
  14.     strlwr(gets(str));
  15.  
  16.     if(strcmp(str, "int") == 0)
  17.         printf("%d to %d", INT_MIN, INT_MAX);
  18.     else if(strcmp(str, "char") == 0)
  19.         printf("%d to %d", CHAR_MIN, CHAR_MAX);
  20.     else if(strcmp(str, "long") == 0)
  21.         printf("%d to %d", LONG_MIN, LONG_MAX);
  22.     else if(strcmp(str, "short char") == 0)
  23.         printf("%d to %d", SCHAR_MIN, SCHAR_MAX);
  24.     else if(strcmp(str, "short") == 0)
  25.         printf("%d to %d", SHRT_MIN, SHRT_MAX);
  26.     else if(strcmp(str, "unsigned char") == 0)
  27.         printf("%d to %u", 0, UCHAR_MAX);
  28.     else if(strcmp(str, "unsigned int") == 0)
  29.         printf("%d to %u", 0, UINT_MAX);
  30.     else if(strcmp(str, "unsigned long") == 0)
  31.         printf("%d to %u", 0, ULONG_MAX);
  32.     else if(strcmp(str, "unsigned short") == 0)
  33.         printf("%d to %u", 0, USHRT_MAX);
  34.     else
  35.         printf("Not a valid data type");
  36.  
  37.     getch();
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement