Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

( a ) There are few errors in the following code. Rewrite the code correctly. Do minimum changes. Try not to introduce any new error.

(a) There are few errors in the following code. Rewrite the code correctly. Do minimum changes. Try not to introduce any new error. #Include int Main(){ int a, b, float sum; scanf(%f%d, a, b); sum =+ a; print(%d, &sum); return 0; }[3](b) Find the outputs when input values of x are (i)3,(ii)10,(iii)17 and (iv)21, respectively. scanf(%d, &x); switch (x){ case 0: printf(Good); break; case 3: printf(Morning); case 7: printf(Hello); break; case 11: printf(World); case 17: printf(Best); break; case 21: printf(Wishes!); default: printf(Invalid answer); }[3](c) Suppose, Team A and Team B are playing a football match. Write a program that will take two integers as input from the keyboard and print the outcome of the match. The two input integers represent the goals scored by Team A and Team B in order. The team with the higher score wins the match. If both scores are equal, the match is declared a draw. The program displays the result of the match accordingly. Few sample inputs and outputs are given below. Sample Input Sample Output 00 Draw! 02 Team B wins! 32 Team A wins! [4]2.(a) Show the manual tracing of variables i, j and sum of the following program. #include void main(){ float sum=0; for(int i=10, j=1; i>0; i=i+2, j++){ sum += i-j; }}[3](b) Draw a flowchart that takes an integer n as input from the user and computes the sum of the following series. 1222+3242+[3](c) Write a program that takes an integer n as input from the user and prints the following pattern using nested loop. Sample Input, n Sample Output 3 ABC AB A 5 ABCDE ABCD ABC AB A [4]3.(a) For the following program, (i) Show the manual tracing of variables n and m.(ii) Show the output. int main(){ int arr1[5]={1,2,3,4,5}; int arr2[5]={5,4,3,2,1}; int arr3[5]; int m=0, n=0; int i, j; for(i=0;i<5; i++){ for(j=0;j<5;j++){ if(arr1[i]==arr2[j]){ n++; m = arr1[i]; arr3[i]=m; }}// printf("Output -1") printf("%d :
", n); }//printf("Output -2"); for(i=4;i>=0; i--){ printf("%d :
", arr3[i]); } return 0; }[3][3](b) Write a program in C to take input into an integer array of size 50 from user. Find and display the minimum element and its index. Name the array with your firstname.solve it c language

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases DeMYSTiFieD

Authors: Andy Oppel

2nd Edition

0071747990, 978-0071747998

More Books

Students also viewed these Databases questions