Skip to main content

Posts

Showing posts from March, 2015

C Program To Replace Lowercase Characters By Uppercase Or Vice-Versa.

This program checks each character one by one. If the character is in lowercase, then it is converted into uppercase. But if it is in uppercase then converts into lowercase. The source code is successfully compiled and run on any operating system. #include <stdio.h> #include <ctype.h> int main() { char sentence[100]; int count, ch, i; printf("Enter One or Multiple Sentence:\n\n\t"); for (i = 0; (sentence[i] = getchar()) != '\n'; i++) {         ; }

C Program To Find The Sum Of Diagonal Elements Of A Matrix.

The properties of any element Aij will be diagonal element if and only if i = j. #include<stdio.h> int main(){ int a[100][100],i,j,sum=0,m,n; printf("\nEnter the row and column of matrix: \n"); scanf("%d %d",&m,&n); printf("\nEnter the elements of matrix: \n"); for(i=0;i<m;i++) for(j=0;j<n;j++) scanf("%d",&a[i][j]); printf("\nThe matrix is\n");