mardi 13 avril 2021

code not working? It is giving me error and i am not able to solve [closed]

This piece of code is giving me this error: expected initializer before 'void' void num(int a) plz explain

#include<iostream>
using namespace std;
int main()

void num(int a)
{
    if(a%2==0)
    cout<<"EVEN";
    else
    cout<<"ODD";
}

{
    int n;
    cout<<"Enter a number: ";
    cin>>n;
    
    cout<<"The numher is : "<<num(n);
}

Aucun commentaire:

Enregistrer un commentaire