C Tutorials

C Program on Structures 0

C Program on Structures

Program 1 // Program for Structure #include<stdio.h> #include<conio.h> #include<stdlib.h> #include<string.h> struct product { char pname[50]; int qty; int price; };struct product p[5]; int main() { system(“cls”); int i; for(i=0;i<5;i++) { fflush(0); printf(“\n Enter Product...

Structures in C Programming 0

Structures in C Programming

Program 1 // Program for Structure #include<stdio.h> #include<conio.h> #include<stdlib.h> #include<string.h> struct Student { int rno; char name[50]; float per; }; struct Student s[5]; // Array of Structure int main() { system(“cls”); int i; for(i=0;i<5;i++)...

Recursion in C 0

Recursion in C

Program 1 // Implementation of recursion #include<stdio.h> #include<conio.h> int main() { static int i=1; if(i>10) exit(0); printf(“%d\n”,i); i++; main(); return 0; } Program 2 // Implementation of recursion #include<stdio.h> #include<conio.h> int factorial(int); int main()...

Storage Classes in C Programming 0

Storage Classes in C Programming

Program 1 // Implementation of storage classes #include<stdio.h> #include<conio.h> void display(); extern int a=10; auto int b=100; int main() { system(“cls”); display(); printf(“\n%d”,a); return 0; } void display() { printf(“\n%d”,a); a=a+5; }  

Pointers in C 0

Pointers in C

Program 1 // Implementation of pointer and pointer to pointer #include<stdio.h> #include<conio.h> int main() { int a=50,*p; system(“cls”); // printf(“Value is: %d”,a); // printf(“\nAddress is: %u”,&a); p=&a; printf(“a=%d *p=%d “,a,*p); ++*p; ++a; printf(“a=%d *p=%d...

User-Defined Function in C 0

User-Defined Function in C

Program 1 // Program for user define function #include<stdio.h> #include<conio.h> #include<string.h> int addition(int ,int); // declare int main() { system(“cls”); int x,y,z; printf(“Enter two number”); scanf(“%d%d”,&x,&y); z=addition(x,y); //calling call by value printf(“Addition is %d”,z);...

Strings in C Part – 3 0

Strings in C Part – 3

Program 1 // Program for copy and concat string #include<stdio.h> #include<conio.h> #include<string.h> int main() { char str1[50],str2[50]; int i; system(“cls”); printf(“Enter a string: “); gets(str1); // using inbuild // strcpy(str2,str1); // puts(str2); // //...

Strings in C Part – 2 0

Strings in C Part – 2

Program 1 // Program for string lower to upper and upper to lower #include<stdio.h> #include<conio.h> #include<string.h> int main() { char str[50]; int len,i; system(“cls”); printf(“Enter a string in lower case: “); gets(str); // using...

Strings in C Part – 1 0

Strings in C Part – 1

Program 1 // Program for String #include<stdio.h> #include<conio.h> #include<string.h> int main() { char name[20]; // String int i=0; system(“cls”); printf(“Enter your Name: “); //scanf(“%s”,name); // not allowed space gets(name); puts(name); //printf(“%s”,name); // while(name[i]!=’\0′) //...

C Program to Multiply Two Matrix 0

C Program to Multiply Two Matrix

Program 1 // Program for matrix multiplication #include<stdio.h> #include<conio.h> int main() { system(“cls”); int a[50][50],b[50][50],c1[50][50],m,n,r,c,k; xyz:printf(“Enter value of row and column”); scanf(“%d%d”,&m,&n); if(m>50 || n>50) { printf(“Invalid limit of row or column\n”); goto xyz;...