C Tutorials

0

C Program to Write Custom Functions

Program 1 #include<stdio.h> #include<conio.h> void display(); void fact(); // Declare void main() { printf(“\n Main Starts…”); display(); fact(); // Calling printf(“\n Main Ends…”); } void fact() //Defination { int f=1,n; printf(“\nEnter a Number”); scanf(“%d”,&n);...

0

C Program for Multiplication of Two Matrices

Program 1 // Program for Matix Multiplication #include<stdio.h> #include<conio.h> int main() { int a1[50][50],b1[50][50],c1[50][50]; int r,c,m,n,k; printf(“\nEnter values of rows and cols\n”); scanf(“%d%d”,&m,&n); // Scan first matrix printf(“\nEnter elements in first matrix\n”); for(r=0;r<m;r++) {...

0

C Program to Add Two Matrix

Program 1 #include<stdio.h> #include<conio.h> int main() { int a[50][50],b[50][50],result[50][50],r,c,r1,c1,m,n; printf(“\nEnter Values of row and col for first matrix”); scanf(“%d%d”,&m,&n); // First Matrix input printf(“\nEnter elements of first matrix.”); for(r=0;r<m;r++) { for(c=0;c<n;c++) { scanf(“%d”,&a[r][c]); }...

0

C Program to Print Transpose of a Matrix

Program 1 // Program for Transpose of Matrix #include<stdio.h> #include<conio.h> int main() { int a[50][50],r,c,m,n; printf(“Enter the values of Rows and Cols”); scanf(“%d %d”,&m,&n); printf(“Enter elements in matrix”); for(r=0;r<m;r++) { for(c=0;c<n;c++) scanf(“%d”,&a[r][c]); } for(r=0;r<m;r++)...

0

C Program For String Palindrome

Program 1 // Program for string palindrome without using inbuild function #include<stdio.h> #include<conio.h> #include<string.h> int main() { char s[100]; int i,j,f=0; printf(“Enter a string: “); gets(s); i=0; j=strlen(s)-1; while(i<=j) { if(s[i]!=s[j]) { f=1; break;...

0

C Program For String

Program 1 // String Related Programming in C #include<stdio.h> #include<conio.h> #include<string.h> int main() { char str[100]; int i; printf(“Enter a String…”); gets(str); //scanf(“%s”,str); i=0; //printf(“%s”,str); while(str[i]!=’\0′) { printf(“%c”,str[i]); i++; } return 0; } Program...

0

C Program For String Functions

Program 1 // Functions of string in c Programming #include<stdio.h> #include<conio.h> #include<string.h> int main() { char s1[100], s2[100],s3[100]; int x; printf(“Enter First string: “); gets(s1); printf(“Enter First string: “); gets(s2); puts(s1); puts(s2); strcpy(s3,s1); strcat(s3,s2);...

0

C Program to Implement Binary Search

Program 1 // Binary Search in C #include<stdio.h> #include<conio.h> int main() { int ar[500],n,i,j,temp,beg,end,mid,f=0,s; xyz:printf(“\nEnter limit for array”); scanf(“%d”,&n); if(n>500) { printf(“\nInvalid limit pls enter between 1 to 500”); goto xyz; } printf(“\nEnter elements...

0

C Program to Implement Linear Search

Program 1 //Program for Liner Search from Array #include<stdio.h> #include<conio.h> int main() { int ar[500],n,i,max,s,f=0; xyz:printf(“\nEnter limit for array”); scanf(“%d”,&n); if(n>500) { printf(“\nInvalid limit pls enter between 1 to 500”); goto xyz; } printf(“\nEnter...