Monday, July 2, 2018

C program to count number of letters in a word

#include<stdio.h>

int main(){
    int count=0,i=0;
printf("Type a word  ");
char word[50];
scanf("%s",&word);
printf("\nYou typed the word  \'%s\' \n",word);
while(word[i]!='\0'){
    count++;
    i++;
}
printf("\nTotal number of letters in %s are %d\n",word,count);
return 0;
}

No comments:

Post a Comment

Sacred Thought

5 May 2024 Hari Om Verse 50-51, chapter two:  In this chapter two Shree krishna explains a simple way of living. Free from desires and void ...