C & DS Record Manual 1-44 Programs for ECE-A & ECE-B
EXPERIMENT 1: PROGRAM TO PRINT THE SIZES ANDRANGES OF DIFFERENT DATA TYPES#include<stdio.h>#include<conio.h>#include<limits.h>#include<float.h>void main(){clrscr();printf(" DATA TYPE SIZE IN BYTES MINIMUMVALUE MAXIMUM VALUE");printf("\n INTEGER(SIGNED) %d %i %d ",sizeof(int),INT_MIN,INT_MAX);printf("\nSHORT INTEGER %d %hi %hd",sizeof(short),SHRT_MIN,SHRT_MAX);printf("\nLONG INTEGER %d %ld %ld",sizeof(long),LONG_MIN,LONG_MAX);printf("\nUNSIGNED INTEGER %d %u%u",sizeof(unsigned int),0,UINT_MAX);printf("\nUNSIGNED SHORT INTEGER %d %u%u",sizeof(unsigned short),0,USHRT_MAX);printf("\nUNSIGNED LONG INTEGER %d %d%lu",sizeof(unsigned long),0,ULONG_MAX);printf("\nFLOAT %d 3.4E%d 3.4E+%d",sizeof(float),FLT_MIN_10_EXP,FLT_MAX_10 _EXP);printf("\nDOUBLE %d 1.7E%d 1.7E+%d",sizeof(double),DBL_MIN_10_EXP,DBL_MAX_10_EXP);printf("\nLONG DOUBLE %d 3.4E%d1.1E+%d",sizeof(longdouble),LDBL_MIN_10_EXP,LDBL_MAX_10_EXP);printf("\nCHARACTER(SIGNED) %d %d%d",sizeof(char),SCHAR_MIN,SCHAR_MAX);printf("\nUNSIGNED CHAR %d %d%d",sizeof(unsigned char),0,UCHAR_MAX);getch();}EXPERIMENT 2: DEMONSTRATING INTEGER CONSTANTS#include<stdio.h>#include<conio.h>void main(){clrscr();printf("\n integer constants are three types");printf("\n[1] decimal integer consist of a set of digits,0 through9,\npreceded by anoptional - or + sign");printf("\n valid examples of decimal integer constants are:");printf("\nint %d \n int %d \n long int %ld \n unsigned long int%lu \n long int%ld",+123,-378,-32271L,76542LU,12789845L);printf("\n[2] an octal integer constant consists of anycombination of 0 through 7, with a1
Leave a Comment