..

FreePrograms


  CONTACT US   ABOUT US   PRIVACY  DISCLAIMER

FREE C PROGRAMS 

What is C C vs C++ vs Java Program Structure Data Types in C Basic Rules of C & C++
Functions in C If, Else Conditions Loops in C Switch Case Arrays
Pointers Structures in C Strings in C Command Line Arguments Type Casting
Linked Lists Recursion Binary Trees Inheritance Multiple Inheritance
Templates File I/O Object Oriented Programming  Data Structures in C C interview Questions

C programming Tutorial : Free C Programs, C Programs Download

Total Number of Consonants in a String

#include<stdio.h>//header file
#include<conio.h>//header file
#include<string.h>//header file
void main() //starting of the main() function
{
int c=0,i,l,p; //declaration of the variables
char a[10];
clrscr();
printf("program that gives total no. of consonants in a string");
printf("\n\n\n\t\t------------INPUT-------------");
printf("\n\nenter any string");//taking input from the user
scanf("%s",&a);
l=strlen(a);
for(i=0;i<l;i++)
{
if(a[i]=='a' || a[i]=='e' || a[i]=='o' || a[i]=='i' || a[i]=='u')
c++;
}
p=l-c;
printf("\n\n\n\t\t------------OUTPUT------------");
printf("\n\nthe total no. of consonants in the string are=%d",p);//printing output
getch();
}

COPYRIGHT 2009 ALL RIGHTS RESERVED FREECPROGRAMS.COM