0

Can you tell me where's the problem in my code? It's always printing 'Oops! We missed your Birthday.'

#include <stdio.h> int main() { char bd_month[10]; int bd_date; printf("When is your birthday?\n"); scanf("%d %s", &bd_date, &bd_month); if (bd_date == 5 && bd_month == 'november') printf("Happy Birthday to you!"); else if (bd_date >= 6 && bd_month == 'november') printf ("Happy Birthday in advance!"); else if (bd_month == 'december' || bd_month == 'january') printf ("Happy Birthday in advance!"); else printf ("Oops! We missed your Birthday."); return 0; }

5th Nov 2020, 5:08 PM
Tanzim Ikram Sheikh
Tanzim Ikram Sheikh - avatar
3 Réponses
0
NotAPythonNinja Mmm....can't I run this code correctly without using strcmp? Btw I have tried to run code without '&'. But it's showing error.
5th Nov 2020, 5:34 PM
Tanzim Ikram Sheikh
Tanzim Ikram Sheikh - avatar
0
NotAPythonNinja Thank you so much bro! Btw does 0 mean true here?
5th Nov 2020, 6:09 PM
Tanzim Ikram Sheikh
Tanzim Ikram Sheikh - avatar
0
What about positive and negative value?NotAPythonNinja
5th Nov 2020, 6:19 PM
Tanzim Ikram Sheikh
Tanzim Ikram Sheikh - avatar