0% found this document useful (0 votes)
28 views

C Program To Check Whether Input Alphabet Is A Vowel or Not #Include

This document contains C code for several programs involving arrays and matrices. It includes programs to: display elements of a 3x3 matrix; calculate and display the sum of two 3x3 matrices; calculate and display the subtraction of two 3x3 matrices; display the transpose of a 3x3 matrix; calculate and display the multiplication of two 3x3 matrices; and display the sum of rows and columns of a 3x3 matrix separately.

Uploaded by

taru9986
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views

C Program To Check Whether Input Alphabet Is A Vowel or Not #Include

This document contains C code for several programs involving arrays and matrices. It includes programs to: display elements of a 3x3 matrix; calculate and display the sum of two 3x3 matrices; calculate and display the subtraction of two 3x3 matrices; display the transpose of a 3x3 matrix; calculate and display the multiplication of two 3x3 matrices; and display the sum of rows and columns of a 3x3 matrix separately.

Uploaded by

taru9986
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

c program to check whether input alphabet is a vowel or not

#include<stdio.h>
main()
{
char ch;
printf("Enter a character\n");
scanf("%c",&ch);
switch(ch)
{
case 'a':
case 'A':
case 'e':
case 'E':
case 'i':
case 'I':
case 'o':
case 'O':
case 'u':
case 'U':
printf("%c is a vowel.\n", ch);
break;
default:
printf("%c is not a vowel.\n", ch);
}return 0;}

/*arrays program
display the elements of a matrix*/
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,a[3][3];
clrscr();
puts("enter the elements");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
scanf("%d",&a[i][j]);
}
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
printf("%d\t",a[i][j]);
printf("\n");
}
/*arrays program
display sum of 2 matrices*/
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,a[3][3],b[3][3],c[3][3];
c[i][j]=0;
clrscr();
puts("enter the elements");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
scanf("%d",&a[i][j]);
}
puts("enter for 2nd array");

for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
scanf("%d",&b[i][j]);
}
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
c[i][j]=a[i][j]+b[i][j];
}
}
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
printf("%d\t",c[i][j]);
printf("\n");
}

getch();
}
/*arrays program
display subtraction of 2 matrices*/
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,a[3][3],b[3][3],c[3][3];
c[i][j]=0;
clrscr();
puts("enter the elements");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
scanf("%d",&a[i][j]);
}
puts("enter for 2nd array");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
scanf("%d",&b[i][j]);
}
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
c[i][j]=a[i][j]-b[i][j];
}
}
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)

printf("%d\t",c[i][j]);
printf("\n");
}

getch();
}
/*arrays program
display the transpose of a matrices*/
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,a[3][3];
clrscr();
puts("enter the elements");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
scanf("%d",&a[i][j]);
}
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
printf("%d\t",a[j][i]);
printf("\n");
}
getch();
}
/*arrays program
display multiplication of 2 matrices*/
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,a[3][3],b[3][3],c[3][3];
clrscr();
puts("enter the elements");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
scanf("%d",&a[i][j]);
}
puts("enter for 2nd array");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
scanf("%d",&b[i][j]);
}
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{

c[i][j]=0;
for(int k=0;k<3;k++)
c[i][j]=c[i][j]+a[i][k]*b[k][j];
}
}
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
printf("%d\t",c[i][j]);
printf("\n");
}

getch();
}
/*arrays program
display sum of row and column seprately*/
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,a[3][3],sum1=0,sum2=0;
clrscr();
puts("enter the elements");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
scanf("%d",&a[i][j]);
}
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
if(i==j)
sum1+=a[i][j];
if(i+j==2)
sum2+=a[i][j];
}
}
printf("sum of left diagonal - %d",sum1);
printf("\nsum of right diagonal -%d ",sum2);
getch();
}
/*arrays program
display sum of row and column seprately*/
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,a[3][3],c,r;
clrscr();
puts("enter the elements");
for(i=0;i<3;i++)
{

for(j=0;j<3;j++)
scanf("%d",&a[i][j]);
}
for(i=0;i<3;i++)
{
c=0;
r=0;
for(j=0;j<3;j++)
{
c=c+a[j][i];
r=r+a[i][j];
}
printf("sum of row - %d is %d",i+1,r);
printf("\nsum of column - %d is %d\n",i+1,c);
}
getch();
}

You might also like