Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions ARRAY Problems/LargestElementinArray.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* C Program to find the largest number in an array using loops
*/

#include <stdio.h>

int main()
{
int size, i, largest;

printf("\n Enter the size of the array: ");
scanf("%d", &size);
int array[size]; //Declaring array

//Input array elements

printf("\n Enter %d elements of the array: \n", size);

for (i = 0; i < size; i++)
{
scanf(" %d", &array[i]);
}

//Declaring Largest element as the first element
largest = array[0];

for (i = 1; i < size; i++)
{
if (largest < array[i])
largest = array[i];
}

printf("\n largest element present in the given array is : %d", largest);

return 0;
}
35 changes: 35 additions & 0 deletions String Problems/Totalvowelconsonants.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#define str_size 100 //Declare the maximum size of the string

void main()
{
char str[str_size];
int i, len, vowel, cons;

printf("\n\nCount total number of vowel or consonant :\n");
printf("----------------------------------------------\n");
printf("Input the string : ");
fgets(str, sizeof str, stdin);

vowel = 0;
cons = 0;
len = strlen(str);

for(i=0; i<len; i++)
{

if(str[i] =='a' || str[i]=='e' || str[i]=='i' || str[i]=='o' || str[i]=='u' || str[i]=='A' || str[i]=='E' || str[i]=='I' || str[i]=='O' || str[i]=='U')
{
vowel++;
}
else if((str[i]>='a' && str[i]<='z') || (str[i]>='A' && str[i]<='Z'))
{
cons++;
}
}
printf("\nThe total number of vowel in the string is : %d\n", vowel);
printf("The total number of consonant in the string is : %d\n\n", cons);
}