【正文】
for ( count = 1。 i ++ ) for ( j = 0。 j++ ) printf ( %5d, p[i][j] )。 scanf(%f, amp。s[i][2])。 i ++ ) printf( Total marks of student % is : %.2f\n, s[i][0], m[i] )。 } for ( i = 0, max = m[0], k = 0。 i M。 for ( k = i = j = 0。 i++。 for ( i = 0。 i N。 i ++ ) { for ( j = 0。 for ( i = 0。 i ++ ) { for ( j = 0。 i++ ) scanf ( %d, amp。 t = a[k]。 for ( i = 0。 j = N i。 printf ( Please the number you want to find:)。 } else if ( n a [k] ) j = k 1。 gets ( name )。 gets ( n )。 int n, m, i。m)。 int count = 0, i, j。 word[j]。 else i++。\039。 str[i]。 i ++ ) printf ( %c, str[i] )。 printf (How many characters do you want to extract?)。 } i ++ 。 int i = 1。 int i = 0。 if ( n == a[k] ) { flag = 1。 i N。 i++ ) /*sorting*/ { k = 0。 } 6/2/2022 Chapter 7 Arrays Develop a program to implement the binary search algorithm. This technique pares the search key value with the value of the element that is midway in a sorted list. Then: (a) If they match, the search is over. (b) If the search key value is less than the middle value, then the first half of the list contains the key value. (c) If the search key value is greater than the middle value, then the second half contains the key value. Repeat this divideandconquer strategy until we have a match. If the list is reduced to one nonmatching elements, then the list does not contain the key value. Use the sorted list created in exercise or use any other sorted list. 6/2/2022 Chapter 7 Arrays define N 10 main() { int a[N], i, j, t, k, n, flag = 0。 j = N i。 for ( i = 0。 for ( i = 0。 } printf ( \n )。 for ( i = 0。 printf(Please input matrix B of %d by %d:\n, N, N)。 } 6/2/2022 Chapter 7 Arrays Two matrices that have the same number of rows and columns can be multiplied to produce a third matrix. Consider the following two matrices. The product of A and B is a third matrix C of size nxn where each element of C is given by the following equation. Write a program that will read the values of elements of A and B and produce the product matrix C. ??????????????????????????nnnnnnnnnnnnbbbbbbbbbBaaaaaaaaaA212222111211212222111211??????????????? nkkjikij baC16/2/2022 Chapter 7 Arrays define N 10 main ( ) { int a[N][N], b[N][N], c[N][N], i, j, k。 continue。 j++ ) scanf ( %d, amp。 printf(Input %d numbers of array a in ascending order:\n, M)。 k = i。} for ( i = 0。 printf(The mark of Subjcet 2 : )。 i N。 i ++ ) { for ( j = 0。 for ( i = 0。count )。 to end the voting.\n )。 i = n。c )。 printf ( +1/%d!, m )。 int i, m = 1。 else if ( i =10 amp。 printf ( %ld, n % 2 )。 m ++。 i++ ) printf ( _ )。 i = 9。 for ( i = 1。 scanf ( %d, amp。 for ( j = 1。 j++ ) printf ( %d, i )。 } } printf ( \nPress enter key to continue... )。 r 。 for ( p = 1000。 count = n。 i ++。 scanf ( %d, amp。 scanf ( %ld, amp。m )。 scanf ( %ld, amp。amp。 printf ( b = )。 scanf ( %f, amp。 printf ( Please input the value of x: )。 } 6/2/2022 Chapter 5 Decision Making and Branching Write a program that will read the value of x and evaluate the following using (a) nested if statements (b) else if statements, and (c) conditional operator ? : ??????????010001xf o rxf o rxf o ry6/2/2022 Chapter 5 Decision Making and Branching main ( ) /* (a) */ { float x。 } else switch ( (int) (price1)/100 ) { case 0: discount = 。m39。 char category。amp。math )。 printf ( \n About the set of two liner equations:\n )。 scanf ( %f, amp。a )。 if ( n % 2 ) printf ( %d IS ODD\n, n )。 scanf ( %d, amp。 printf ( Add them\t%6d\n, y*x)。 scanf ( %d%d, amp。 printf ( (c) (x+y)(xy) = %f\n, (x+y)*(xy) )。 printf ( x = )。 printf ( y = )。 scanf ( %f, amp。 printf ( \n\t\t%6d\n\t\t*%5d\n, x, y )。odd39。 if ( n % 2 == 0 ) printf ( %d IS EVEN\n, n )。 printf ( About a set of two liner equations:\n )。b )。 scanf ( %f, amp。 else printf (The result: x1 = %.2f, x2 = %.2f\n, (m*d b*n)/(a*d c*b), (n*a m*c)/(a*d c*b) )。phy )。 chem=40 amp。category )。 case 1: discount = 。 break。x )。 if ( x 0 ) printf ( y = 1\n )。 } 6/2/2022 Chapter 5 Decision Making and Branching Write a program to pute the real roots of a quadratic equation The roots are given by the equations The program should request for the values of the constants a, b and c and print the values of x1, and x2. Use the following rules: (a) No solution, if both a and b are zero (b) There is only one root, if a=0 (x=c/b) (c) There are no real roots, if b24ac is negative (d) Otherwise, there are two real roots Test your program with appropriate data so that all logical paths are working as per your design. Incorporate appropriate output messages. aacbbxaacbbx2424 2221????????02 ??? cbxax6/2/2022 Chapter 5 Decision Making and Branching include main ( ) { float a, b, c, f。 printf ( c = )。 else { f = b * b 4 * a * c。 n = n / 10。 m 。 n = n / 10。 while ( i = m ) { printf ( %12ld , f )。 printf ( Enter the values of x and n: )。 n = %d。 for ( n = 1。 for ( n = 1。 } } 6/2/2022 Chapter 6 Decision Making and Looping Write programs to print the following outputs using for loops. (a) 1 (b) ***** 22 **** 333 *** 4444 ** 55555 * 6/2/2022 Chapter 6 Decision Making and Looping main ( ) /* (a) */ { int i, j。 for ( i = 5。 printf ( \n )。