Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

8/3/2021 QUES_9_D4 | DS_Day_4 Question | Contests | HackerRank

NEW
PRACTICE CERTIFICATION COMPETE JOBS LEADERBOARD  Search   arindam_ghosh007

All Contests

DS_Day_4

QUES_9_D4

QUES_9_D4

Problem Submissions Leaderboard Discussions

  
Write a program to count the number of vowels and consonants in a string
Contest ends in
4 days
Input Format
Submissions:
4
NA
Max Score:
10
Constraints Difficulty: Medium

NA Rate This Challenge:







Output Format
More
NA

Sample Input 0

University

Sample Output 0

No. of Vowels : 4

No. of Consonants: 6

Explanation 0

NA

Current Buffer
(saved locally, editable)
  

 C  

1 ▾#include<stdio.h>
2 #include<string.h>
3
4 ▾int main(){
5    int v=0,c=0;
6    char s1[]="University";
7 ▾    for(int i=0;i<strlen(s1);i++){
8 ▾        if(s1[i]=='a' ||s1[i]=='e' || s1[i]=='i' ||s1[i]=='o' || s1[i]=='u' || s1[i]=='A' || s1[i]=='E'
|| s1[i]=='I' || s1[i]=='O' ||s1[i]=='U'){
9            v++;
10 ▾       }else{
11            c++;
12       }
13   }
14    printf("No. of Vowels : %d\n",v);
15    printf("No. of Consonants: %d",c);
16
17 }

Line: 17
Col: 2

https://www.hackerrank.com/contests/ds-day-4/challenges/ques-9-d4 1/2
8/3/2021 QUES_9_D4 | DS_Day_4 Question | Contests | HackerRank

 Upload Code as File


Test against custom input Run Code
Submit Code

Testcase 0 ✓

Congratulations, you passed the sample test case.


Click the Submit Code button to run your code against all the test cases.

Input (stdin)

University

Your Output (stdout)

No. of Vowels : 4

No. of Consonants: 6

Expected Output

No. of Vowels : 4

No. of Consonants: 6

Contest Calendar
|
Interview Prep
|
Blog
|
Scoring
|
Environment
|
FAQ
|
About Us
|
Support
|
Careers
|
Terms Of Service
|
Privacy Policy
|
Request a Feature

https://www.hackerrank.com/contests/ds-day-4/challenges/ques-9-d4 2/2

You might also like