Ternary Operators
  • void main()
    int hat;
    printf("Enter number of hats");
      printf("hat",(hat==1? "." : "s"));

    i want, if user right 1 so print hat otherwise hats ... but its not working .....
  • 2 Comments sorted by
  • try

      printf("hat %s",(hat==1? "." : "s"));

    and tell is problem resolved or not ?

  • Its working. Thank you. :)

Howdy, Stranger!

It looks like you're new here. If you want to get involved, or you want to Ask a new Question, Please Login or Create a new Account by Clicking below

Login with Facebook

Popular Posts of the Week