Escrito por estudiantes que aprobaron Inmediatamente disponible después del pago Leer en línea o como PDF ¿Documento equivocado? Cámbialo gratis 4,6 TrustPilot
logo-home
Document preview thumbnail
Vista previa 2 fuera de 10 páginas
Examen

c-programming-past-exam-worked-solutions.

Document preview thumbnail
Vista previa 2 fuera de 10 páginas

C Programming Past Exam worked solutions Engineering Computing II (National University of Ireland Galway) Write a function in C that takes one argument, an array of 5 elements. Your function should print out the value of the smallest element in the array.

Vista previa del contenido

lOMoARcPSD|12096575




C Programming Past Exam worked solutions

Engineering Computing II (National
University of Ireland Galway)

, lOMoARcPSD|12096575




Write a function in C that takes one argument, an array of 5 elements. Your function should print out the value of
the smallest element in the array.
#include <stdio.h>

int question(int

list[5]); void main()
{
int
list[5];
int i;
int min;

for(i=0;i<5;i++)
{
printf("What is the value in cell %d ? : ", i+1);
scanf("%d", &list[i]);
}

min=question(list);

printf("This is the smallest number in your array: %d\n", min);

system("pause");
}

int question(int list[5])
{
int i=0;
int min=list[1];

for (i=0;i<5;i++)
{
if(list[i]<min)
min=list[i];
}

return min;
}




Write a program in C that reads in 5 floating point numbers that represent the sales figures of 5 sales staff. Once
the 5 numbers have been read in your code should find the largest individual sales. Your code should then use this
value to display all those sales figures which are less than 20% of the highest value.

#include

<stdio.h> void

main()
{
float
sales[5]; int
i;
float most_sales=0;
int compare;

for(i=0;i<5;i++)
{
printf("What is the sales of salesperson %d ? : ",
i+1); scanf("%f", &sales[i]);
}

for(i=0;i<5;i++)
{
if(sales[i]>most_sales)
most_sales=sales[i];

Información del documento

Subido en
20 de mayo de 2022
Número de páginas
10
Escrito en
2021/2022
Tipo
Examen
Contiene
Preguntas y respuestas
$10.99

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
frackasaura
3.8
(16)
Vendido
66
Seguidores
53
Artículos
673
Última venta
7 meses hace


Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes