ramsese kabir
سه شنبه 04 تیر 1387, 01:14 صبح
#include <stdio.h>
#include <conio.h>
#include <string.h>
int strlen(char[30]);
int main()
{
char str[30];
int len = 0;
int counter = 1;
int ptr ;
int i;
printf("please enter ur character:\n");
scanf("%s",&str);
len = strlen( str );
for ( i=0 ; i <= len ; i++ )
{
ptr = i + 1;
while( str[ptr] != '\0' )
{
if ( str[ i ] == str[ptr] )
counter++;
ptr++;
}
printf("Num of '%s' = %d\n", str[ i ] , counter);
counter = 1;
}
getch();
return 0;
}
int strlen(char str[30])
{
int j=0;
while(str[j]!= '\0')
{
j++;
}
return j;
}
#include <conio.h>
#include <string.h>
int strlen(char[30]);
int main()
{
char str[30];
int len = 0;
int counter = 1;
int ptr ;
int i;
printf("please enter ur character:\n");
scanf("%s",&str);
len = strlen( str );
for ( i=0 ; i <= len ; i++ )
{
ptr = i + 1;
while( str[ptr] != '\0' )
{
if ( str[ i ] == str[ptr] )
counter++;
ptr++;
}
printf("Num of '%s' = %d\n", str[ i ] , counter);
counter = 1;
}
getch();
return 0;
}
int strlen(char str[30])
{
int j=0;
while(str[j]!= '\0')
{
j++;
}
return j;
}