Computer Science, asked by purviaditi1908, 6 months ago

WAP to accept a mobile company name (data type string) . Check if company name is an Apple, then print it‟s an Apple mobile, otherwise print its not an Apple mobile.

Answers

Answered by mad210203
1

Program is given below.

Explanation:

#include <stdio.h>

#include <string.h>

int main()

{

   char string[100],apple[]="Apple";

   int flag;

   printf("Enter a mobile company name: ");

   gets(string);

   flag=strcmp(string,apple);

   if(flag==0)

   printf("Given mobile is an Apple mobile.");

   else

   printf("Given mobile is not an Apple mobile.");

   return 0;

}

Refer the attached image for the output.

Attachments:
Similar questions