Home Basic Loop Array string Function Pointer Contact STUDY

AHF    C    PROGRAM    SOLVING

Programming tips

Comment



Iterative statement



Test expression



" ; " after loop



Working with switch case




String_ count total word in a string




// AHF C PROGRAM SOLVING

//solving here 2_D   ARRAY 	programming problem

#include #define pf printf int main() { char str[100]; int i,count=1; pf("Enter the string: "); gets(str); for(i=0;str[i]!='\0';i++) { //32 is ASCII value which indicate "space" if(str[i]==32) count++; } printf("\nThe total word in the string= %d",count); return 0; }
OUTPUT:


© 2018 - All rights reserved