Basic Programs

If Else based Programs

Loop Based Programs

Array Based Programs

String Programs

Function Programs

Pointers Programs

Structure & File Handling Programs

Data Structure Programs

String based programs

C Program to count four letter word in given string


#include<conio.h> #include<stdio.h> void main() { int i=0,j=0, k=0; char d[50], c[50]; printf("Enter the string : "); gets(d); for(i=0;d[i]!='\0';i++) { j=0; while(d[i]!=32 && d[i]!='\0')
{ j++; i++; } if(d[i]=='\0')
i--; if(j==4) { k=k+1; } } printf("Four letter word are : %d", k); }

Output of the above program is as following.

Video/ C Introduction

Watch video in full size
Wordpress Social Share Plugin powered by Ultimatelysocial