include <stdio.h> main(){int a[10][10], b[10][10], c[10][10], i, j, row, col; } OUTPUT:Enter number of rows and columns of Matrix: 3 3 Enter Elements of an Array A:1 1 1 1 1 1 1 1 1 Enter Elements of an Array B:2 2 2 2 2 2 2 2 2 Elements of Matrix A are: Elements …
Start reading C Program to ADD two MATRICESBlog
Check a Character is Vowel or not Using C programming. The following program uses switch case to check all the vowels. #include <stdio.h>int main(){char ch;printf(“\nEnter Single Character: “);scanf(“%c”, &ch);switch (ch){case ‘a’:case ‘A’:printf(“\n\n%c is a vowel”, ch);break;case ‘e’:case ‘E’:printf(“\n\n%c is a vowel”, ch);break;case ‘i’:case ‘I’:printf(“\n\n%c is a vowel”, ch);break;case ‘o’:case ‘O’:printf(“\n\n%c is a vowel”, ch);break;case ‘u’:case …
Start reading Check a Character is Vowel or not Using Cinclude include main(){char s1[20], s2[20];printf(“\nEnter first string: “);gets(s1);printf(“\nEnter second string: “);gets(s2);strcat(s1, s2);printf(“\nThe concatenated string is: %s”, s1);getch();}OUTPUT: Enter first string: Programming Enter second string: .com
Start reading C Program to CONCATENATE Two Strings using strcat()include include int main(){char s1[20], s2[20];int result;printf(“\nEnter first string: “);gets(s1);printf(“\nEnter second string: “);gets(s2);result = strcmp(s1, s2);if (result == 0)printf(“\nBoth strings are equal”);elseprintf(“\nBoth strings are not equal”);return 0;}OUTPUT:Enter first string: Programming9.com Enter second string: Programming9.com Both strings are equal
Start reading C Program to Compare Two Strings using strcmp()include swap (int, int);main(){int a, b;printf(“\nEnter value of a & b: “);scanf(“%d %d”, &a, &b);printf(“\nBefore Swapping:\n”);printf(“\na = %d\n\nb = %d\n”, a, b);swap(a, b);printf(“\nAfter Swapping:\n”);printf(“\na = %d\n\nb = %d”, a, b);getch();}swap (int a, int b){int temp;temp = a;a = b;b = temp;}OUTPUT:Enter value of a & b: 10 20 Before Swapping: a = 10 b = …
Start reading C Program to Implement Call By Value using Functionsinclude include main(){char s1[20];int len;printf(“\nEnter any string: “);gets(s1);len = strlen(s1);printf(“\nLength of string: %d”, len);getch();}OUTPUT:Enter any string: programming9.com Length of string: 16
Start reading C Program to Find Length of a String Using STRLEN()include include int main(){char str[50];int i=0, word=0, chr=0;printf(“\nEnter Your String: “);gets(str);while (str[i] != ‘\0’){if (str[i] == ‘ ‘){word++;chr++;}elsechr++;i++;}printf(“\nNumber of characters: %d”, chr);printf(“\nNumber of words: %d”, word+1);return 0;}OUTPUT:Enter Your String: Welcome to Programming9 .com Number of characters: 28Number of words: 4
Start reading C Program to Find Number of Characters and Words in a Stringinclude int main(){int i, n, a, sq;printf(“\n\tProgram finds square of positive numbers only\n”);printf(“\nHow many numbers you want to enter: “);scanf(“%d”, &n);for (i=1; i<=n; i++){printf(“\nEnter Number: “);scanf(“%d”, &a);if (a < 0)continue;sq = a * a;printf(“\nSquare of a Number : %d\n”, sq);}return 0;}OUTPUT:Program finds square of positive numbers only How many numbers you want to enter: 3 …
Start reading C Program to Implement CONTINUE statementBreak is a simple statement. It only makes sense if it occurs in the body of a switch, do, while or for statements. When it is executed, the control flow jumps out of the loop when the condition met. If you use break, it will go out of the loop and executes the statements out …
Start reading C program to Implement BREAK Statementinclude swap (int *, int *);int main(){int a, b;printf(“\nEnter value of a & b: “);scanf(“%d %d”, &a, &b);printf(“\nBefore Swapping:\n”);printf(“\na = %d\n\nb = %d\n”, a, b);swap(&a, &b);printf(“\nAfter Swapping:\n”);printf(“\na = %d\n\nb = %d”, a, b);return 0;}swap (int *x, int *y){int temp;temp = *x;*x = *y;*y = temp;} OUTPUT:Enter value of a & b: 10 20 Before Swapping: …
Start reading Swapping of Two Numbers Using Call By Reference in C