Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

programming, c-language?

Write a program that accepts a astring with maximum string length of 10 characters and displays the number of consonants in the string. (assume that all characters on the string contains letters only.)

i ran out of ideas T_T

1 Answer

Relevance
  • 1 decade ago
    Favorite Answer

    include<stdio.h>

    #include<conio.h>

    main()

    {

    int vow=0,con=0,space=0,i;

    char name[10];

    clrscr();

    printf("enter your string");

    gets(name);

    for(i=0;a[i]!='\0';i++)

    {

    if((a[i]=='a')||(a[i]=='e')||(a[i]=='i')||(a[i]=='o')||(a[i]=='u')||(a[i]=='A')||a[i]=='E')||(a[i]=='I')||(a[i]=='O')|(a[i]=='U'))

    vow++;

    else if(a[i]==' ')

    space++;

    else

    con++;

    }

    printf("\n\n no of consonants in your string is %d",con);

    getch();

    }

    Source(s): i am a trainer
Still have questions? Get your answers by asking now.