EASy68K  
It is currently Sun Dec 16, 2018 10:21 am

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Fri Feb 18, 2011 2:29 pm 
Offline

Joined: Fri Feb 18, 2011 3:08 am
Posts: 1
How can I write program to count the number of ‘S’s in the text message
‘ASSESSMENT'.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 18, 2011 2:36 pm 
Offline
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1087
How would you write this program in your favorite language?

_________________
Prof. Kelly


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 21, 2011 10:00 pm 
Offline

Joined: Mon Jul 26, 2010 11:43 pm
Posts: 198
Location: Aurora, IL
Code:
// COUNT LETTERS NOT WORDS

int CountSs(char *s)
{
  int i = 0;

  while(*s) if (*s++ == 'S') i++;

  return(i);
}

main()
{
  printf("%d LETTER S's\n",CountSs("FAILS"));
}


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group