WAP using C-Function to check Odd Number and Even Number from a given input.
#include<stdio.h>
int evenodd(int a);
int main()
{
int a;
printf("\nEnter the number: ");
scanf("%d",&a);
evenodd(a);
}
int evenodd(int q)
{
if (q%2 = = 0)
printf("\nThis is a even number");
else if (q%2 = = 1)
printf("\nThis is a odd number");
}
#include<stdio.h>
int evenodd(int a);
int main()
{
int a;
printf("\nEnter the number: ");
scanf("%d",&a);
evenodd(a);
}
int evenodd(int q)
{
if (q%2 = = 0)
printf("\nThis is a even number");
else if (q%2 = = 1)
printf("\nThis is a odd number");
}
#include
উত্তরমুছুনint numcheck(int num);
main()
{
int num;
printf("Enter the number: ");
scanf("%d",&num);
numcheck(num);
}
int numcheck(int a)
{
if(a%2==0)
printf("The number is even");
else
printf("The number is odd");
}
#include
উত্তরমুছুনmain()
{
int m;
printf("Enter your digit : ");
scanf("%d",&m);
number (m);
}
int number (int n)
{
if(n%2==0)
printf("\neven number\n");
else if(n%2==1)
printf("\nnot even number\n");
}
#include
উত্তরমুছুনmain()
{
int m;
printf("Enter your digit : ");
scanf("%d",&m);
number (m);
}
int number (int n)
{
if(n%2==0)
printf("\neven number\n");
else if(n%2==1)
printf("\nodd number\n");
}
#include
উত্তরমুছুন#include
int check_even(int h);
int main()
{
int k,result;
printf("\n Enter number for check if it is even or not; ");
scanf("%d",&k);
result=check_even(k);
getch();
return 0;
}
int check_even(int c)
{
int i=2;
if(c%i==0)
printf("\n It is even number");
else
printf("\n It is odd number");
getch();
return i;
}
#include
উত্তরমুছুন#include
int check_even(int);
int main()
{
int n,result;
printf("\n Enter number for check if it is even or not; ");
scanf("%d",&n);
result=check_even(n);
getch();
return 0;
}
int check_even(int a)
{
int i=2;
if(a%i==0)
printf("\n It is even number");
else
printf("\n It is odd number");
getch();
return i;
}
#include
উত্তরমুছুনmain()
{
int m;
printf("Enter your digit : ");
scanf("%d",&m);
number (m);
}
int number (int n)
{
if(n%2==0)
printf("\neven number\n");
else if(n%2==1)
printf("\nnot even number\n");
}
#include
উত্তরমুছুনint evenodd(int a);
main()
{
int a;
printf("enter the number:");
scanf("%d",&a);
evenodd(a);
getch();
}
int evenodd(int q)
{
if(q%2==0)
printf("this is a even number");
else if(q%2==1)
printf("this is a odd number");
}
#include
উত্তরমুছুনint evenodd(int a);
main()
{
int a;
printf("enter the number:");
scanf("%d",&a);
evenodd(a);
getch();
}
int evenodd(int q)
{
if(q%2==0)
printf("this is a even number");
else if(q%2==1)
printf("this is a odd number");
}
#include
উত্তরমুছুনint main(){
int num;
printf("Enter an integer you want to check: ");
scanf("%d",&num);
if((num%2)==0) /* Checking whether remainder is 0 or not. */
printf("%d is even.",num);
else
printf("%d is odd.",num);
return 0;
}
#include
উত্তরমুছুনint checkOddEven(int n)
{
if(n%2==0)
{
printf("%d is a even number.\n", n);
}
else if(n%2==1)
{
printf("%d is a odd number.\n", n);
}
}
void main()
{
int n;
printf("Enter a number : ");
scanf("%d",&n);
checkOddEven (n);
}
#include
উত্তরমুছুনusing namespace std;
int even_odd(int x)
{
if(x%2==0)
cout<<"the number is even";
else
cout<<"the number is odd";
}
main()
{
int a;
cout<<"enter the number"<>a;
cout<<' ';
even_odd(a);
}
ID:201210411
উত্তরমুছুন#include
using namespace std;
int main ()
{
int number;
cout<<"Enter number to check it is Even or odd: ";
cin>>number;
if(number%2==0)
cout<<"Number is Even";
else
cout<<"Number is Odd";
return 0;
}
#include
উত্তরমুছুনusing namespace std;
int evenodd(int i)
{
if(i%2==0)
cout<<"Even number"<>num;
evenodd(num);
}
Id-201210803
উত্তরমুছুন#include
using namespace std;
int odd_even(int value)
{
if (value %2 == 0 )
cout << "The number is Even.";
else
cout << "The number is Odd.";
cout << "\n\n";
}
main()
{
int number=0;
cout << "Enter a Number : ";
cin >> number;
odd_even(number);
}
#include
উত্তরমুছুনusing namespace std;
void oddeven(int a)
{
if(a%2==0)
cout << "It is a even number." <> b;
oddeven(b);
}
#include
উত্তরমুছুনmain()
{
int m;
printf("Enter your digit : ");
scanf("%d",&m);
number (m);
}
int number (int n)
{
if(n%2==0)
printf("\neven number\n");
else if(n%2==1)
printf("\nnot even number\n");
}
#include
উত্তরমুছুনusing namespace std;
class evod
{
public:
int n;
evod();
void show();
~evod()
{
}
};
evod::evod()
{
cout<<"Input Number To check even or odd: ";
cin>>n;
}
void evod::show()
{
if(n%2==0)
cout<<"THis is Even Number";
else
cout<<"This is Odd Number";
}
int main()
{
evod appel;
appel.show();
}
#include
উত্তরমুছুনusing namespace std;
class cheak
{
public:
int num;
cheak();
void show();
~cheak();
};
cheak::cheak()
{
cout<<"Enter a number: ";
cin>>num;
cout<<endl;
}
void cheak::show()
{
if(num%2==0)
cout<<"EVEN"<<endl;
else
cout<<"ODD"<<endl;
}
cheak::~cheak()
{
}
int main()
{
cheak obj;
obj.show();
return 0;
}
#include
উত্তরমুছুনusing namespace std;
class check_odd_or_even
{
public:
int num;
check_odd_or_even();
void show();
};
check_odd_or_even::check_odd_or_even()
{
cout<<"Enter a number: ";
cin>>num;
}
void check_odd_or_even::show()
{
int i;
if(num%2==0)
cout<<endl<<num<<" is even.";
else
cout<<endl<<num<<" is odd.";
}
main()
{
check_odd_or_even ob1,ob2;
ob1.show();
ob2.show();
}
using C++
উত্তরমুছুন#include
using namespace std;
class cons
{
public:
int num;
cons(int i);
~cons();
void result();
};
cons::cons(int i)
{
num = i;
}
void cons::result()
{
if (num == 0)
cout << "Enter correct number --: \n";
else if (num % 2 == 0)
cout << num << " Is a even number --\n" ;
else
cout << num << " Is a odd number --\n";
}
cons::~cons()
{
cout << "[+]MEMORY RELEASED[+]\n";
}
int main()
{
int i;
cout << "Eneter that number you want to check --: ";
cin >> i;
cons obj(i);
obj.result();
return 0;
}
#include
উত্তরমুছুনusing namespace std;
class cheak
{
public:
int n;
cheak();
void show();
~cheak();
};
cheak::cheak()
{
cout<<"Enter a number:";
cin>>n;
}
void cheak::show()
{
if(n%2==0)
cout<<"Even"<<endl;
else
cout<<"odd"<<endl;
}
cheak::~cheak()
{
}
int main()
{
cheak obj;
obj.show();
return 0;
}
using constructor
উত্তরমুছুনmamun ur rashid
#include
using namespace std;
class OEN
{
public:
int p;
OEN();
~OEN();
void result();
};
OEN::OEN()
{
cout<<"Enter a number :" ;
cin>>p;
}
OEN::~OEN()
{
}
void OEN::result()
{
if(p%2==0)
cout<<"This is even nimber :";
else if(p%2==1)
cout<<"This is odd number:";
}
int main()
{
OEN sb;
sb.result();
}
#include
উত্তরমুছুনusing namespace std;
class even_odd
{
public:
int a;
even_odd();
~even_odd();
void result();
};
even_odd::even_odd()
{
cout<<"Enter the number to check even or odd :" <>a;
}
even_odd::~even_odd()
{
}
void even_odd::result()
{
if(a%2==0)
cout<<"This is a even nimber :";
else if(a%2==1)
cout<<"This is a odd number:";
}
int main()
{
even_odd ob;
ob.result();
}
#include
উত্তরমুছুনusing namespace std;
class check
{
public:
int num,sum=0;
check();
~check()
{
cout<<"Distructor active";
}
int func()
{
if(num%2==0)
cout<<"This number is even"<>num;
}
int main()
{
check obj;
obj.func();
return 0;
}
id:201510660
#include
উত্তরমুছুনusing namespace std;
class check
{
public:
int num;
check();
~check()
{
cout<<"Distructor active";
}
int setu()
{
if(num%2==0)
cout<<"This number is even"<>num;
}
int main()
{
check obj;
obj.setu();
return 0;
}
id:201510992
using c++
উত্তরমুছুন#include
using namespace std;
class cons
{
public:
int num;
cons(int i);
~cons();
void result();
};
cons::cons(int i)
{
num = i;
}
void cons::result()
{
if (num == 0)
cout << "Enter correct number --: \n";
else if (num % 2 == 0)
cout << num << " Is a even number --\n" ;
else
cout << num << " Is a odd number --\n";
}
cons::~cons()
{
cout << "[+]MEMORY RELEASED[+]\n";
}
int main()
{
int i;
cout << "Eneter that number you want to check --: ";
cin >> i;
cons obj(i);
obj.result();
return 0;
}