Two separate questions. Need two seperate programs. Programs need to both be in
ID: 3569760 • Letter: T
Question
Two separate questions. Need two seperate programs. Programs need to both be in C programming.FIRST PROGRAM: 1. Write a program that takes four integers as user input and prints the third largest as output.
SECOND PROGRAM: 2. Write a program that takes 3x3 matrix as user input and prints the determinate of the matrix as output.
Thank you! I will choose a best answer. Two separate questions. Need two seperate programs. Programs need to both be in C programming.
FIRST PROGRAM: 1. Write a program that takes four integers as user input and prints the third largest as output.
SECOND PROGRAM: 2. Write a program that takes 3x3 matrix as user input and prints the determinate of the matrix as output.
Thank you! I will choose a best answer. Two separate questions. Need two seperate programs. Programs need to both be in C programming.
FIRST PROGRAM: 1. Write a program that takes four integers as user input and prints the third largest as output.
SECOND PROGRAM: 2. Write a program that takes 3x3 matrix as user input and prints the determinate of the matrix as output.
Thank you! I will choose a best answer.
Explanation / Answer
1)
#include<stdio.h>
int main(){
int a[4],i,c,d,max=0;
printf("Enter four numbers");
for(i=1;i<4;i++){
scanf("%d",&a[i]);
}
for (c = 0 ; c < 4; c++)
{
for (d = 0 ; d <4; d++)
{
if (array[d] > array[d+1]) /* For decreasing order use < */
{
swap = array[d];
array[d] = array[d+1];
array[d+1] = swap;
}
}
}
printf("%d",a[2]);
}
2)
#include<stdio.h>
int main()
{
int a[3][3], i , j;
printf("Enter matrix elements:");
for (i = 0; i < 3; i++)
{
for ( j = 0; j < 3; j++)
{
scanf("%d",&a[i][j]);
}
}
for (i = 0; i < 3; i++)
{
for ( j = 0; j < 3; j++)
{
printf("a[%d][%d] = %d ", i, j, a[i][j]);
}
}
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.