Soru

mail@pastecode.io avatar
unknown
plain_text
7 months ago
809 B
33
Indexable
Never
#include <stdio.h>
#include <string.h>

#define SIZE 100

int		is_alpha(char c)
{
	return ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'));
}

int		is_num(char c)
{
	return (c >= '0' && c <= '9');
}

int		main()
{
	char	buffer[SIZE];
	int		num_index;
	int		letters_index;
	char	nums[SIZE];
	char	letters[SIZE];

	printf("Bir cumle giriniz:\n");
	scanf("%s", buffer);

	num_index = 0;
	letters_index = 0;
	for(int i = 0; i < strlen(buffer); i++)
	{
		if(is_alpha(buffer[i]))
			letters[letters_index++] = buffer[i];
		else if(is_num(buffer[i]))
			nums[num_index++] = buffer[i];
	}
	nums[num_index] = '\0';
	letters[letters_index] = '\0';
	printf("Harf sayisi: %d\nRakam Sayisi: %d\nHarfler: %s\nRakamlar: %s\n", letters_index, num_index, letters, nums);
	return (0);
}
Leave a Comment