CODE: #include<stdio.h> #include<limits.h> #include<float.h> int main() { printf(“Range of integer value:%d to %d \n”,INT_MIN,INT_MAX); printf(“Range of char value:%d to %d \n”,CHAR_MIN,CHAR_MAX); printf(“Range of float value:%e to %e \n”,FLT_MIN,FLT_MAX); printf(“Range of double value:%e to %e \n”,DBL_MIN,DBL_MAX); printf(“Range of long double value:%e … Continue reading
CODE: #include<stdio.h> int main() { int a,b,c,x,y,z,lcm,hcf,r,lcm1; printf(“Enter three number\n”); scanf(“%d%d%d”,&x,&y,&z); a=x; b=y; c=z; while(x!=0) { r=y%x; y=x; x=r; } lcm=(a*b)/y; while(y!=0) { r=z%y; z=y; y=r; } hcf=z; lcm1=(lcm*c)/hcf; printf(“LCM:%d”,lcm1); printf(“HCF:%d”,hcf); return 0; }
CODE : #include<stdio.h> int main() { int **a,**b; int i,j; a=(int **)malloc(sizeof(int)*10); b=(int **)malloc(sizeof(int)*10); for(i=0;i<10;i++) { *(a+i)=(int *)malloc(sizeof(int)*10); *(b+i)=(int *)malloc(sizeof(int)*10); } printf(“Enter Elements of Array is:\n”); for(i=0;i<3;i++) { for(j=0;j<3;j++) { scanf(“%d”,(*(a+i)+j)); } } printf(“Elements are:\n”); for(i=0;i<3;i++) { for(j=0;j<3;j++) { printf(“%d\t”,*(*(a+i)+j)); … Continue reading
code : #include<stdio.h> #include<stdlib.h> struct distance { int feet,meter; float inch,cm; }; struct distance display(struct distance d1,struct distance d2,struct distance d3,struct distance d4); struct distance convert(struct distance d3); struct distance addlist(struct distance d1 ,struct distance d2); struct distance input (); … Continue reading
CODE: #include<stdio.h> union endian { int i; unsigned char ch[4]; }e; int main() { e.i=0XAABBCCDD; if(e.ch[0]==0XDD) { printf(“Underlying architecture is Little endian\n”); } else { printf(“Underlying architecture is Bigendian\n”); } printf(“%#X\n”,e.i); printf(“%#X\n”,e.ch[0]); printf(“%#X\n”,e.ch[1]); printf(“%#X\n”,e.ch[2]); printf(“%#X\n”,e.ch[3]); }
CODE: #include<stdio.h> #include<stdlib.h> int main() { int a,b,sum,carry; printf(“Enter Values\n”); scanf(“%d%d”,&a,&b); carry=a&b; printf(“carry:%d\n”,carry); sum=a^b; printf(“Sum:%d\n”,sum); while(carry) { carry<<=1; printf(“carry:…%d\n”,carry); a=sum; printf(“a:%d\n”,a); b=carry; printf(“b:%d\n”,b); sum=a^b; printf(“sum:%d\n”,sum); carry=a&b; printf(“carry:…%d\n”,carry); } printf(“…..Sum=%d…..\n”,sum); }
CODE : #include<stdio.h> #include<stdlib.h> int fact (int ); int main() { int n; printf(“Enter number whose factroialu want u find\n”); scanf(“%d”,&n); printf(“Factorial of %d is %d\n”,n,fact(n)); return 0; } int fact( int n ) { if(n!=1) return n*fact(n-1); }
code : #include<stdio.h> #include<stdlib.h> int fibo(int); int main() { int n,i,k; printf(“Enter maximum length of fibonacci series\n”); scanf(“%d”,&n); for(i=0;i<n;i++) { printf(“%d “,fibo(i)); } } int fibo(int i) { if(i==0) return 0; else if(i==1) return 1; else return (fibo(i-1)+fibo(i-2)); }
code : #include<stdio.h> #include<stdlib.h> int main() { system(“clear”); int n,el,j,i,flag=0; printf(“Enter Max Size\n”); scanf(“%d”,&n); int a[n]; printf(“Enter Element\n”); for(i=0;i<n;i++) { scanf(“%d”,&a[i]); } printf(“Enter Element U Want To Delete\n”); scanf(“%d”,&el); for(i=0;i<n;i++) { if(a[i]==el) { flag=1; for(j=i;j<n;j++) { a[j]=a[j+1]; } } } … Continue reading
code: #include<stdio.h> #include<stdlib.h> int main() { system(“clear”); int a[10],b[10],c[20],m,n,o,i,j,k,temp; printf(“Enter size of Array1\n”); scanf(“%d”,&n); printf(“Enter size of Array2\n”); scanf(“%d”,&m); o=m+n; printf(“Enter Elements of Array1\n”); for(i=0;i<n;i++) { scanf(“%d”,&a[i]); } printf(“Enter Elements of Array2\n”); for(i=0;i<m;i++) { scanf(“%d”,&b[i]); } for(i=0;i<n;i++) { for(j=0;j<n-1-i;j++) { … Continue reading
code: #include<stdio.h> #include<math.h> int main() { int a,b,c,d,e,f; float s,g,h,r1,r2; printf(“Enter constant:”); scanf(“%d%d%d”,&a,&b,&c); d=(b*b-4*a*c); if(a==0 && b==0) { printf(“There is no solution\n”); } else if(a==0) { e=-c/b; printf(“There is only one root:%d\n”,e); } else if(d<1) { printf(“Roots are complex\n”); f=abs(d); … Continue reading
CODE : #include<stdio.h> #include<stdlib.h> int main() { char *str1,*str2; int i,j,k,m=0,o; str1=(char *)malloc(sizeof(char)); str2=(char *)malloc(sizeof(char)); printf(“Enter String1:”); gets(str1); printf(“Enter String2:”); gets(str2); for(i=0;str1[i]!=”;i++) { printf(“String[%d]=%c\n”,i,*(str1+i)); } for(j=0;str2[j]!=”;j++) { printf(“String[%d]=%c\n”,j,*(str2+j)); } printf(“string1: %s i is %d\n”,str1,i); printf(“string2: %s j is %d\n”,str2,j); o=i+j; … Continue reading
CODE: #include<stdio.h> #include<stdlib.h> int main() { int n,temp,i,j; printf(“Enter size of Array\n”); scanf(“%d”,&n); int a[n]; printf(“Enter Elements \n”); for(i=0;i<n;i++) { scanf(“%d”,&a[i]); } printf(“Elements Are:\n”); for(i=0;i<n;i++) { printf(“%d\t”,a[i]); } printf(“\n”); for(i=0,j=n-1;i<=n/2;i++,j–) { temp=a[i]; a[i]=a[j]; a[j]=temp; } printf(“Reversed array:\n”); for(i=0;i<n;i++) { printf(“a[%d]=%d\n”,i,a[i]); … Continue reading
#include<stdio.h> #include<stdlib.h> int main() { int r,c,i,j,a[10][10],t[10][10]; printf(“Enter Max Size\n”); scanf(“%d”,&r); printf(“Enter Column\n”); scanf(“%d”,&c); printf(“Enter Element of Matrix1\n”); for(i=0;i<r;i++) { for(j=0;j<c;j++) { scanf(“%d”,&a[i][j]); } } printf(“Elements are:\n”); for(i=0;i<r;i++) { for(j=0;j<c;j++) { printf(“%d\t”,a[i][j]); } printf(“\n”); } for(i=0;i<r;i++) { for(j=0;j<c;j++) { t[j][i]=a[i][j]; … Continue reading
Prototype : – #include <stdio.h> char *fgets(char *s, int size, FILE *stream); Defination :- fgets() reads in at most one less than size characters from stream and stores them into the buffer pointed to by s. Reading stops after an … Continue reading