to get a line of text and count the number of vowels in it
Answers were Sorted based on User's Feedback
Answer / chandra sekhar kommuri
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char st[100];
int i,count=0;
clrscr();
printf("Enter line of text:");
gets(st);
for(i=0;st[i]!='\0';i++)
switch(st[i])
{
case 'a':
case 'A':
case 'e':
case 'E':
case 'i':
case 'I':
case 'o':
case 'O':
case 'u':
case 'U':count++;
}
printf("\n Number of vowels:%d",count);
getch();
}
Is This Answer Correct ? | 75 Yes | 24 No |
Answer / swe
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char st[100];
int i,count=0;
clrscr();
printf("Enter line of text:");
gets(st);
for(i=0;st[i]!='\0';i++)
{
switch(st[i])
{
case 'a':count++;
break;
case 'A':count++;
break;
case 'e':count++;
break;
case 'E':count++;
break;
case 'i':count++;
break;
case 'I':count++;
break;
case 'o':count++;
break;
case 'O':count++;
break;
case 'u':count++;
break;
case 'U':count++;
break;
}
}
printf("\n Number of vowels:%d",count);
getch();
}
Is This Answer Correct ? | 32 Yes | 15 No |
Answer / sachin
Write a program to print the size of all the data types supported by C and its range?
Is This Answer Correct ? | 0 Yes | 0 No |
What are the different pointer models in c?
A collection of data with a given structure for excepting storing and providing on demand data for multiple users a) linked list b) datastructer c) database d) preprocessor
write a program to sum of its digit with using control structure or with out using loop. for ex: let the number is 25634 then answer will be=2+5+6+3+4=20
What are qualifiers and modifiers c?
Who is invented by c?
Write a program to produce the following output: 1 2 3 4 5 6 7 8 9 10
write a program which the o/p should b in such a way that s triangle if I/p is 3,a Square/rectangle if I/P=4,a pentagon if I/P=5 and so on...forget about the I/P which is less than 3
what is the difference between declaration and definition of a variable or function ?
Just came across this question, felt worth sharing, so here it is I want you to make a C/C++ program that for any positive integer n will print all the positive integers from 1 up to it and then back again! Let's say n=5 I want the program to print: 1 2 3 4 5 4 3 2 1. Too easy you say? Okay then... You can ONLY USE: 1 for loop 1 printf/cout statement 2 integers( i and n) and as many operations you want. NO if statements, NO ternary operators, NO tables, NO pointers, NO functions!
What is the use of define in c?
Please list all the unary and binary operators in C.
What is array in C