Computer Science, asked by RAM2611, 2 days ago

Write a C program to get a character from the user. And display the message "Yes" if and only if the given character is not equal to 'n' or 'N'​

Answers

Answered by amvk2712005
0

Answer:

#include<stdio.h>

int main()

{

  char ch;

  scanf("%c",&ch);

  if((ch != 'n') && (ch != 'N'))

  {

      printf("Yes");

  }

   return 0;

}

Explanation:

step 1: We are creating a character variable(I named it ch).

step 2: we are getting input from the user(using scanf function) and storing it in a character type variable.

step 3: in the if statement we are checking whether the variable ch has the letter n or N in it by using (not equal to) relational operator (!=) and AND LOGIC (&&).

step 4: If ch is not equal to n or N ,it will print YES.

Similar questions
Math, 8 months ago