void input(char str[]){
gets(str);
}
void display(char str[]){
int i;
for(i=0;str[i]!='\0';i++)
printf("%c ",str[i]);
printf("\n");
}
int countA(char str[]){
int i,count=0;
for(i=0;str[i]!='\0';i++){
if(str[i]=='a'||str[i]=='A')
count++;
}
return count;
}
int findItem(char array[],int size,char item){
int i,found=0;
for(i=0;array[i]!='\0';i++){
if(array[i]==item){
found=1;
break;
}
}
return found;
}
int isPalindrome(char str1[]){
int i,size=strlen(str1)-1;
int yes=1;
for(i=0,j=size-1;i<=size/2;i++,j--){
if(str1[i]!=str1[j]){
yes=0;
break;
}
}
return yes;
}
int countVowel(char str[]){
int i,count=0;
for(i=0;str[i]!='\0';i++){
//val=toupper(str[i]);
//if(val=='A'||val=='E'||val=='I'||val=='O'||val=='U')
if(str[i]=='a'||str[i]=='A'||str[i]=='e'||str[i]=='E'
||str[i]=='i'||str[i]=='I'||str[i]=='o'||str[i]=='O'||str[i]=='u'||str[i]=='U')
count++;
}
return count;
}
MAIN CODE
#include<stdio.h>
#include"strings.h"
int main(void){
char string1[30]="hello world";
input(string1);
display(string1);
printf("%d\n",countA(string1));
return 0;
}
About this blog
These codes here are just based on my own knowledge learned from my IT subjects. I know there are more ways that this draft codes can be enhance, so..
Please feel free to comment & suggest.. Suggest Codes which makes my existing codes simpler.. Thanks!
Archives
Categories
Making Life Simple w/ Programming
Links
- w3schools.com
- Java & Textpad Setup Guide 2
- Java & Textpad Setup Guide
- ASCII Alphabet Characters
- File Handling - Forum
- File Handling - Tutorial 0.1
- File Handling - Tutorial 0.2
- Bin-Dec Conversion - Forum
- Use of getch(), getche(), & getchar()
- The C Book
- SEO
- Common C programming errors
- Tutorial - Array Functions
- August Council Tutorial - c
- C language tutorials
- cprogramminglanuage.net
0 comments