Sınav Sorusu

mail@pastecode.io avatar
unknown
plain_text
6 months ago
581 B
32
Indexable
Never
#include <stdio.h>

#define size 25

int		main()
{
	int		nums[size] = {};
	int		max;
	int		max_index;
	int		current;

	for(int i = 0; i < size; i++)
	{
		nums[i] = 1 + (rand() % 99);
		printf("%d ", nums[i]);
	}
	max = 0;
	for(int i = 0; i < size; i++)
	{
		current = 0;
		while(nums[i + current] <= nums[i + current + 1])
			current++;
		if(current > max)
		{
			max = current;
			max_index = i;
		}
	}
	printf("\nArdisik en fazla sayi: %d\n", max);
	for(int i = max_index; i < max_index + max; i++)
	{
		printf("%d ", nums[i]);
	}
	return (0);
}
Leave a Comment