Find total number of character, Blanks Spaces, Full stops and Commas from String.

Find total number of character, Blanks Spaces, Full stops and Commas from String.

/*
Author : Sabya Roy
Program : Find total number of character, Blanks Spaces, Full stops and Commas.
*/

 
#include <stdio.h>
#include <conio.h>
void main()
{
          int character=0,dot=0,comma=0,blank=0,i;
          char ch, str[125];
          printf(“*****String Manipulations*****\n\n”);
          printf(“Enter a string : “);
          gets(str);
          for(i=0;str[i]!=’\0′;i++){
          if(str[i]==’ ‘)
                    blank++;
          else if(str[i]==’.’)
                    dot++;
          else if(str[i]==’,’)
                    comma++;
          }
          character=i;
          printf(“\n\nTotal Characters : %d”,character);
          printf(“\nTotal Blanks : %d”,blank);
          printf(“\nTotal Full stops : %d”,dot);
          printf(“\nTotal Commas : %d”,comma);
          getch();
}

———————————————————————————————————————————————————-




Output :

******String Manipulation*******

Enter a string : My name is Sabya.

Total Characters : 17
Total Blanks        : 3
Total Full Stops  : 1
Total Commas    : 0

———————————————————————————————————————————————————-

Share this post

Comment (1)

  • top 10 product Reply

    I have been exploring for a little bit for any high-quality articles or weblog posts in this
    kind of area . Exploring in Yahoo I at last stumbled upon this site.
    Reading this info So i’m happy to show that I’ve an incredibly good
    uncanny feeling I discovered just what I needed.
    I such a lot without a doubt will make sure to do not overlook this site and provides it a look regularly.

    September 11, 2017 at 4:15 am

Leave a Reply

Your email address will not be published. Required fields are marked *