+ 1
Is this code is valid for oddeven by using function in c
#include <stdio.h> int oddeven(int a){ if(a%2==0) printf("even"); else printf("odd"); return; } int main(){ int a; printf("enter a number"); scanf("%d",&a); oddeven(a); return 0; }
3 Respostas
+ 5
It depends on what the task is and you haven't described the details here.
Your question is therefore unclear.
+ 4
Swapnil Banerjee ,
Your code is valid, just need few changes for look effective.
1:- Remove first `return;`this is not valid/correct `return`statement.
2:-The function is declared as an `int` function, it does not return an integer value. This will show warning or error when you compiling the code. for fixed the issues change return type of the `oddeven()` function to `void`.
See this code...
https://code.sololearn.com/ck1334GYgiXP/?ref=app
+ 3
What you think? Swapnil Banerjee