+3

Why there is an error in this code😔?Your advices are always welcome...

https://code.sololearn.com/ckMxR4xP39SR/?ref=app

10/11/2019 10:28:02 AM

BEN_10🇮🇳

2 Answers

New Answer

+7

Pranav pratap Singh Compiling on cxxdroid gives this. <stdin>:3:1: error: C++ requires a type specifier for all declarations main() ^ //Use return type ! It works in C but still the valid return type is int only <stdin>:25:19: warning: if statement has empty body [-Wempty-body] if(a%2==0); //hmm semicolon after if? <stdin>:25:19: note: put the semicolon on a separate line to silence this warning <stdin>:27:13: error: expected expression else ^ <stdin>:50:26: error: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wreserved-user-defined-literal] printf("\n%d"b); ^ //seperate by specifier and variable by comma. <stdin>:50:26: error: expected ')' <stdin>:50:19: note: to match this '(' printf("\n%d"b); ^ <stdin>:51:13: error: expected expression else ^ //can't use 'else' without if ! edit: that downvote is not mine 😅🍵

+6

Thanks 😊 🇮🇳Omkar🕉 .. Now this code is running as I want..😃