0% found this document useful (0 votes)
38 views3 pages

C PGM

The C program takes a string as input, converts it to uppercase using the toupper() function, and prints the result. It then converts the same string to lowercase using the tolower() function and prints that result.

Uploaded by

Hari Krishnan
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views3 pages

C PGM

The C program takes a string as input, converts it to uppercase using the toupper() function, and prints the result. It then converts the same string to lowercase using the tolower() function and prints that result.

Uploaded by

Hari Krishnan
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

/* Program to transpose the given matrix - MATTRANS.

C */
# include <stdio.h>
# include <conio.h>
void main()
{
int mat[10][10] ;
int i, j, row, col ;
clrscr() ;
printf("Enter the order of the matrix : ") ;
scanf("%d %d", &row, &col) ;
printf("\nEnter the elements of the matrix : \n\n") ;
for(i = 0 ; i < row ; i++)
for(j = 0 ; j < col ; j++)
scanf("%d", &mat[i][j]) ;
printf("\nThe transpose matrix is : \n\n") ;
for(i = 0 ; i < col ; i++)
{
for(j = 0 ; j < row ; j++)
{
printf("%d \t", mat[j][i]) ;
}
printf("\n") ;
}
getch() ;
}

write a c program to find no, of vowels in a string


count no, of vowels in a string using c language

write a c program to find no, of vowels in a string


count no, of vowels in a string using c language

#include <stdio.h>
void main()
{
char *str;
char a[]="aeiouAEIOU";
int i,j,count=0;
clrscr();
printf("\nEnter the string\n");
gets(str);
for(i=0;str[i]!='\0';i++)
{
for(j=0;a[j]!='\0';j++)
if(a[j] == str[i]
{
count++;
break;
}
printf("\nNo. of vowels = %d",count);
getch();
}
}

/* To sort the given strings in alphabetical order - STRSORT.C */

# include <stdio.h>
# include <conio.h>
# include <string.h>
void main()
{
char str[10][20], temp[20] ;
int n, i, j ;
clrscr() ;
printf("Enter the number of strings : ") ;
scanf("%d", &n) ;
printf("\nEnter the strings : \n\n") ;
for(i = 0 ; i < n ; i++)
scanf("%s", str[i]) ;
for(i = 0 ; i < n - 1 ; i++)
for(j = 0 ; j < n - 1; j++)
if(strcmp(str[j], str[j + 1]) > 0)
{
strcpy(temp, str[j]) ;
strcpy(str[j], str[j + 1]) ;
strcpy(str[j + 1], temp) ;
}
printf("\nThe sorted order of strings are : \n\n") ;
for(i = 0 ; i < n ; i++)
printf("%s \n", str[i]) ;
getch() ;
}

Convert string to upper case and lower case

#include <ctype.h>
#include <stdio.h>

int main(void)
{
char str[80];
int i;

printf("Enter a string: ");


gets(str);

for( i = 0; str[ i ]; i++)


str[ i ] = toupper( str[ i ] );

printf("%s\n", str); /* uppercase string */

for(i = 0; str[ i ]; i++)


str[i] = tolower(str[ i ]);

printf("%s\n", str); /* lowercase string */

return 0;
}

You might also like