C Programming Solutions
C Programming Solutions
1. Write a program in C to read n integers in an array and display them in reverse order.
Solution:
#include <stdio.h>
int main() {
int n, i;
int arr[100];
scanf("%d", &n);
");
return 1;
scanf("%d", &arr[i]);
printf("\n");
return 0;
2. Write a program in C to read n integers in an array and find out the minimum and maximum
values.
Solution:
#include <stdio.h>
int main() {
int arr[100];
scanf("%d", &n);
");
return 1;
}
printf("Enter %d integers: ", n);
scanf("%d", &arr[i]);
min = arr[i];
max = arr[i];
return 0;
3. Write a C program that prompts the user to input four different types of numbers and compute
their sum.
Solution:
#include <stdio.h>
int main() {
int int_num;
long long_num;
float float_num;
scanf("%d", &int_num);
scanf("%ld", &long_num);
scanf("%f", &float_num);
scanf("%lf", &double_num);
return 0;