Respuesta :
A program that gets a list of integers from input, and outputs non-negative integers in ascending order
#include <stdio.h>
#include <stdlib.h>
int main(void) {
int num;
int *arr = NULL;
int size = 0;
int capacity = 0;
while (scanf("%d", &num) == 1) {
if (size == capacity) {
if (capacity == 0) {
capacity = 1;
} else {
capacity *= 2;
}
arr = realloc(arr, sizeof(int) * capacity);
}
arr[size] = num;
size++;
}
for (int i = 0; i < size - 1; i++) {
for (int j = 0; j < size - 1 - i; j++) {
if (arr[j] > arr[j + 1]) {
int temp = arr[j];
arr[j] = arr[j + 1];
arr[j + 1] = temp;
}
}
}
for (int i = 0; i < size; i++)
What is integer?
The collection of the whole numbers or negative numbers is known as an integer in mathematics. Integers, like whole numbers, do not include the fractional portion. Integers can therefore be defined as numbers that can be positive, negative, or zero but not as fractions. On integers, we can carry out all arithmetic operations, including addition, subtraction, multiplication, and division. Integer examples include 1, 2, 5, 8, -9, -12, etc. "Z" stands for an integer. Let's now go over the definition of integers, their symbol, types, operations, laws, and properties, as well as how to display them on a number line with numerous worked-out examples.
To learn more about integer
https://brainly.com/question/13906626
#SPJ4