C How to Program (8th Edition)
C How to Program (8th Edition)
8th Edition
ISBN: 9780133976892
Author: Paul J. Deitel, Harvey Deitel
Publisher: PEARSON
Question
Book Icon
Chapter 8, Problem 8.10E
Program Plan Intro

Program Plan:

  • Declare character type variable string1 and string2 to read two strings from the user.
  • Declare variable n of type int to store the number of characters to be compared.
  • Use function strcmp to compare the two string.
  • Declare integer type variable result to store the result of the comparison of two string.
  • Display the comparison result using printf() function.

Program Description: 

The program reads two strings and compares their n characters using strcmp function. Then determines if the first string is less than, equal to or greater than the second string.

Blurred answer
Students have asked these similar questions
(C++ language)
please quickly  thanks !! use Python
4. (Prime Numbers) An integer is said to be prime if it is divisible by only 1 and itself. For example, 2, 3, 5 and 7 are prime, but 4, 6, 8 and 9 are not. Write a function called isPrime that receives an integer and determines whether the integer is prime or not. Write a test program that uses isPrime to determine and prints all the prime numbers between 1 and 1000. Display 10 numbers per line.
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning