What is c programming?
C programming is a general-purpose computer programming language developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system.Although C programming was designed for implementing system software,It is also widely used for developing portable application software.
C programming is one of the most popular programming languages of all time and there are very few computer architectures for which a C compiler does not exist. C programming has greatly influenced many other popular programming languages.
tutorial for c,c examples source code,simple examples of c programs,simple c program examples
C examples source codes for binary to decimal
Bellow is c program example for c programming practice
C source codes for how to sort and merge array
/*************************** author-Nikunj v Gandhi from-gujarat(surat) Web Developer(ZCE) email-nik_gandhi007@yahoo.com http://my-source-codes.blogspot.com/ Description:C programm sort and merge array ******************************************** */ #include<conio.h> #include<stdio.h> void main() { int i,j,k,l,*n,*m,*nm,temp,f=0, curn,curm; clrscr(); printf("How many record u want to insert in array n?"); scanf("%d",&k); k--; printf("How many record u want to insert in array m?"); scanf("%d",&l); l--; printf("Enter value in n Arrayn"); for(i=0;i<=k;i++) { printf("Enter value?"); scanf("%d",&n[i]); } printf("n"); printf("Enter value in M array?n"); for(i=0;i<=l;i++) { printf("enter value?"); scanf("%d",&m[i]); } /*code for sort array n in accending order*/ for(i=0;i<=k;i++) { for(j=i+1;j<=k;j++) { if(n[i]>n[j]) { temp=n[i]; n[i]=n[j]; n[j]=temp; } } } /*code for sort array m in accending order*/ temp=0; for(i=0;i<=l;i++) { for(j=i+1;j<=l;j++) { if(m[i]>m[j]) { temp=m[i]; m[i]=m[j]; m[j]=temp; } } } curn=0;/*curn variable used as a counter for n array*/ curm=0;/*curm variable used as a counter for m array*/ if(k==-1 ||l==-1) { if(k==-1) { for(i=0;i<=l;i++) nm[i]=m[i]; } else if(l==-1) { for(i=0;i<=k;i++) nm[i]=n[i]; } } else { if(n[curn]<=m[curm]) { nm[0]=n[curn]; curn++; f=1; } else if(m[curm]<n[curn]) { nm[0]=m[curm]; curm++; f=0; } for(i=1;i<=k+l+1;i++) { if(curm-1==l) m[l+1]=n[k]+1; else if(curn-1==k) n[k+1]=m[l]+1; if(f==1) { if(n[curn]<=m[curm]) { nm[i]=n[curn]; curn++; f=1; } else if(m[curm]<n[curn]) { nm[i]=m[curm]; curm++; f=0; continue; } } if(f==0) { if(m[curm]<n[curn]) { nm[i]=m[curm]; curm++; f=0; } else if(n[curn]<=m[curm]) { nm[i]=n[curn]; curn++; f=1; } } } } printf("OUT PUTn"); for(i=0;i<=k+l+1;i++) printf("%d ",nm[i]); getch(); }
No comments:
Post a Comment