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

How can I run a C++ program directly from Windows?

How-can-I-run-a-C-program-directly-from-Windows