C Tutorials

C Program to Print Corner Elements of Matrix 0

C Program to Print Corner Elements of Matrix

Program 1 // Program for corner elements of matrix #include<stdio.h> #include<conio.h> int main() { system(“cls”); int a[50][50],m,n,r,c; xyz:printf(“Enter values of row and column”); scanf(“%d %d”,&m,&n); if(m>50 || n>50) { printf(“Invalid values of row and...

C Program to Read and Display Matrix 0

C Program to Read and Display Matrix

Program 1 // Program for read and write matrix #include<stdio.h> #include<conio.h> int main() { system(“cls”); int a[50][50],m,n,r,c; printf(“\nEnter the value of row and column”); scanf(“%d %d”,&m,&n); printf(“\n Enter elements in matrix”); for(r=0;r<m;r++) { for(c=0;c<n;c++)...

While Loop Programs in C 0

While Loop Programs in C

Program 1 // Program for while loop #include<stdio.h> #include<conio.h> int main() { system(“cls”); int i=1; // intilization int limit; printf(“Enter the limit”); scanf(“%d”,&limit); while(i<=limit) // condition { printf(“%d “,i); i++; // increment } return...

Number System Conversion in C 0

Number System Conversion in C

Program 1 // Program for Number System #include<stdio.h> #include<conio.h> int main() { system(“cls”); int a; //a=012+020; // 10+ 16 a=0xDAD; printf(“%d”,a); return 0; }  

Binary Search Algorithm in C 0

Binary Search Algorithm in C

Program 1 // Program for Binary Search #include<stdio.h> #include<conio.h> int main() { int a[500],n,i,j,temp,s,low,high,mid,f=0; system(“cls”); xyz: printf(“\nEnter the limit of array”); scanf(“%d”,&n); if(n<0 || n>500) { printf(“\nInvalid limit please enter again)”); goto xyz; }...

Linear Search Algorithm in C 0

Linear Search Algorithm in C

Program 1 // Program for find max element from Array #include<stdio.h> #include<conio.h> int main() { int a[500],n,i,max,p; system(“cls”); xyz: printf(“\nEnter the limit of array”); scanf(“%d”,&n); if(n<0 || n>500) { printf(“\nInvalid limit please enter again)”);...

Nested Loops in C 0

Nested Loops in C

Program 1 // Program for Pyramid Structure #include<stdio.h> #include<conio.h> int main() { system(“cls”); int n,i,j; printf(“Enter the limit”); scanf(“%d”,&n); for(i=1;i<=n;i++) { for(j=1;j<=i;j++) { printf(“*”); } printf(“\n”); } return 0; } Program 2 #include<stdio.h> #include<conio.h>...

Prime Number Program in C 0

Prime Number Program in C

Program 1 // Program for Prime Number // Program for prime number #include<stdio.h> #include<conio.h> int main() { system(“cls”); int n,i=2,f=0; printf(“Enter a number”); scanf(“%d”,&n); while(i<n) { if(n%i==0) { f=1; break; } i++; } if(f==0)...

C Program to Display Fibonacci Series 0

C Program to Display Fibonacci Series

Program 1 // Program for Fibbonacci series // 0 1 1 2 3 5 8 13 21 …….n #include<stdio.h> #include<conio.h> int main() { int n,a,b,c,i; a=0; b=1; system(“cls”); printf(“Enter the limit”); scanf(“%d”,&n); if(n==1) //...