সি প্রোগ্রামে অনেক সমস্যা থাকে লেটার কাউন্ট নিয়ে বা ওয়ার্ড কাউন্ট নিয়ে বেসিক কনসেপ্ট জানা থাকলে সেগুলো সহজে সমাধান করা যায়। নিচের প্রোগ্রাম টি স্পেস ছাড়া sentence এর শব্দ গুলোর লেটার কাউন্ট করবে
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
int main() | |
{ | |
char str[100]; | |
int i=0,nl=0; | |
gets(str); // it takes input with space | |
while(str[i] !='\0') // null termination character, it marks the the end of string | |
{ | |
char ch= str[i]; | |
if (ch>= 'A' && ch<= 'Z' || ch>= 'a' && ch<= 'z') | |
nl++; | |
i++; | |
} | |
printf("Letter : %d\n",nl); | |
return 0; | |
} |