Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ConsoleApplication1.cpp : This file contains the 'main' function. Program execution begins and ends there.
- //
- #include <stdio.h>
- float arr[10];
- void enter_numbers(int position) {
- if (position == 10)
- return;
- else {
- printf("enter %d number :", position);
- scanf_s("%f", &arr[position]);
- getchar();
- return enter_numbers(++position);
- }
- }
- int minimal_number_position(int position, int step) {
- if (step == 10) {
- return position;
- }
- else {
- if (arr[step] > arr[position]) {
- position = step;
- return minimal_number_position(position, ++step);
- }
- else {
- return minimal_number_position(position, ++step);
- }
- }
- }
- void print_numbers(int pos) {
- if (pos == 10) {
- return;
- }
- else {
- printf("%d . %.2f\n", pos, arr[pos]);
- return print_numbers(++pos);
- }
- }
- int main()
- {
- enter_numbers(0);
- print_numbers(0);
- printf("minimal number position %d",minimal_number_position(0,0));
- getchar();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement