Skip to content
This repository was archived by the owner on Jun 14, 2024. It is now read-only.

Sum.c #177

Open
SanjanaYdv1 opened this issue Mar 16, 2023 · 3 comments
Open

Sum.c #177

SanjanaYdv1 opened this issue Mar 16, 2023 · 3 comments

Comments

@SanjanaYdv1
Copy link

https://replit.com/@SanjanaYadav7/Sumc?s=app

@SanjanaYdv1 SanjanaYdv1 closed this as not planned Won't fix, can't repro, duplicate, stale Mar 16, 2023
@SanjanaYdv1 SanjanaYdv1 reopened this Mar 16, 2023
@Delhibabu1
Copy link

Try using this code

#include <stdio.h>
#include <string.h>

int main()
{
char name[15];
int v=0, c=0, i=0; // Initialize i to 0
printf("Enter any string: ");
scanf("%s", name);

// Use a while loop to iterate over the string
while (name[i] != '\0')
{
// Check if the current character is a vowel
if(name[i]=='a' || name[i]=='e' || name[i]=='i' || name[i]=='o' || name[i]=='u')
{
v++; // Increment the vowel count
}
else
{
c++; // Increment the consonant count
}
i++; // Increment the loop variable
}

// Print the counts of vowels and consonants after the loop
printf("The number of vowels in the string: %d\n", v);
printf("The number of consonants in the string: %d\n", c);

return 0;
}

@Surajitb526
Copy link

45

@SanjanaYdv1
Copy link
Author

Ya, It's work.
Thanks for sharing your idea.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants