Use only C language. Question 1 Find and explain error(s) if any. Rewrite following program using if statements.  int main() { float f=2.3; switch(f) { case 2.1: printf("2.1"); break; case 2.2: printf("2.2"); break; case 2.3: printf("2.3"); } return 0; }

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter5: Repetition Statements
Section: Chapter Questions
Problem 7PP
icon
Related questions
Question

Use only C language.

Question 1

Find and explain error(s) if any. Rewrite following program using if statements.  int main() { float f=2.3; switch(f) { case 2.1: printf("2.1"); break; case 2.2: printf("2.2"); break; case 2.3: printf("2.3"); } return 0; }

Question 2

Write C statements to tokenize the given string and print tokens on the screen char str[50] = “99+2+4+0+5+7 100 900”; (Note: Tokenize the string separated by + sign and space.). Single line text.

Question 3
Complete the code given below to find out the maximum even number in the given array. #include<stdio.h> #define SIZE 5 void find_maxeven(int a[],int s); int main() { int array[SIZE] = {9,2,3,4,1}; int choice; do{ printf("\nMax Even value = %d", find_maxeven(array,SIZE)); printf("Enter 0 to exit:") scanf("%d",&choice); }while(); //Part 1 return 0; } float find_maxeven(int a[],int s); { int max; //Parrt 2 return max; }
Question 4
For the following struct FOO create a variable using new name of struct FOO type given by you and pass that variable to function by reference.The function will print the values on the screen Struct FOO { int x; float y; };.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 2 images

Blurred answer
Knowledge Booster
Structure chart
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr