5. Mr. Ahamed is very much fond of buying new cars. He planned to buy a brand new Toyota use. Write a 'C' program for the following. car for his day to day i). Accept and display any two Toyota car model names. ii). Find and display the smallest among the given car models. iii). Find and display model. the length of the smallest car iv). Accept car plate number and combine with your new car model. Display it.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

 using c_compiler 

5. Mr. Ahamed is very much fond of buying new cars. He
planned to buy a brand new Toyota
use. Write a 'C' program for the following.
car for his day to day
i). Accept and display any two Toyota car model
names.
ii). Find and display the smallest among the given car
models.
iii). Find and display
model.
the length of the smallest car
iv). Accept car plate number and combine with your new car
model. Display it.
Transcribed Image Text:5. Mr. Ahamed is very much fond of buying new cars. He planned to buy a brand new Toyota use. Write a 'C' program for the following. car for his day to day i). Accept and display any two Toyota car model names. ii). Find and display the smallest among the given car models. iii). Find and display model. the length of the smallest car iv). Accept car plate number and combine with your new car model. Display it.
Expert Solution
Step 1

Program:

#include <stdio.h>

#include <string.h>

int main()

{

    char firstModel[100];

    char secondModel[100];

    int numberPlate;

    printf("Enter car model 1-1: ");

    fgets(firstModel, 100, stdin);

    printf("\n");

    printf("Enter car model 1-2: ");

    fgets(secondModel, 100, stdin);

    printf("\n");

    printf("Enter car plate number: ");

    scanf("%d", &numberPlate);

    printf("\n");

    printf("Toyota Car model 1-1: %s \n", firstModel);

    printf("Toyota Car model 1-2: %s \n", secondModel);

    int res = strcmp(firstModel, secondModel);

    if (res == 1)

    {

        printf("The smallest car model name is: %s \n", firstModel);

        int length = strlen(firstModel);

        printf("The length of your new car model: %d \n", (length - 1));

        printf("Car Number & Car Model: %d%s", numberPlate, firstModel);

    }

    else

    {

        printf("The smallest car model name is: %s \n", secondModel);

        int length = strlen(secondModel);

        printf("The length of your new car model: %d \n", (length - 1));

        printf("Car Number & Car Model: %d%s", numberPlate, secondModel);

    }

    return 0;

}

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Introduction to computer system
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.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education