Write a C Program using function to check whether the given input is divisible by 5 or not.
Source Code in C:
#include<stdio.h>
void divis (int p, int q);
int main()
{
int a, b=5;
scanf("%d", &a);
divis(a, b);
}
void divis (int p, int q)
{
if (p%q = =0)
printf ("\n Given number is divisible by 5");
else
printf ("\n Given number is not divisible by 5");
}
Source Code in C:
#include<stdio.h>
void divis (int p, int q);
int main()
{
int a, b=5;
scanf("%d", &a);
divis(a, b);
}
void divis (int p, int q)
{
if (p%q = =0)
printf ("\n Given number is divisible by 5");
else
printf ("\n Given number is not divisible by 5");
}
include
উত্তরমুছুনint numcheck(int num);
main()
{
int num;
printf("Enter the number: ");
scanf("%d",&num);
numcheck(num);
}
int numcheck(int a)
{
if(a%5==0)
printf("The number is divisible by 5");
else
printf("The number is not divisibel by 5");
}
main()
উত্তরমুছুন{
int a,b=5;
scanf("%d",&a);
divise(a,b);
}
int divise(int p,int q)
{
if(p%q==0)
printf("divisable by 5");
else
printf("not divisable by 5");
return 0;
}
#include
উত্তরমুছুনmain()
{
int a,b=5;
printf("Enter your number : ");
scanf("%d",&a);
division(a,b);
}
int division(int m,int n)
{
if(m%n==0)
{
printf("\ndivisable by 5");
}
else
{
(m%n!=0);
printf("\nnot divisable by 5");
}
}
#include
উত্তরমুছুন#include
int check_divisable(int a);
int main()
{
int p,result;
printf("\n Enter number for check if it is divisable or not by 5: ");
scanf("%d",&p);
result=check_divisable(p);
getch();
return 0;
}
int check_divisable(cse)
{
int i=5;
if(cse%i==0)
printf("\n It is divisable by 5");
else
printf("\n It is not divisable by 5");
getch();
return i;
}
#include
উত্তরমুছুন#include
int check_divisable(int);
int main()
{
int n,result;
printf("\n Enter number for check if it is divisable or not by 5: ");
scanf("%d",&n);
result=check_divisable(n);
getch();
return 0;
}
int check_divisable(shohan)
{
int i=5;
if(shohan%i==0)
printf("\n It is divisable by 5");
else
printf("\n It is not divisable by 5");
getch();
return i;
}
#include
উত্তরমুছুনint divisablecheck(int i,int j);
main()
{
int i,j=5;
printf("Enter the number for check if it is divisable by 5:");
scanf("%d",&i);
divisablecheck(i,j);
}
int divisablecheck(int m,int n)
{
if(m%n==0)
printf("divisable by 5");
else
printf("not divisable by 5");
return 0;
}
#include
উত্তরমুছুনint divisablecheck(int i,int j);
main()
{
int i,j=5;
printf("Enter the number for check if it is divisable by 5:");
scanf("%d",&i);
divisablecheck(i,j);
}
int divisablecheck(int m,int n)
{
if(m%n==0)
printf("divisable by 5");
else
printf("not divisable by 5");
return 0;
}
#include
উত্তরমুছুনint divisablecheck(int i,int j);
main()
{
int i,j=5;
printf("Enter the number for check if it is divisable by 5:");
scanf("%d",&i);
divisablecheck(i,j);
}
int divisablecheck(int m,int n)
{
if(m%n==0)
printf("divisable by 5");
else
printf("not divisable by 5");
return 0;
}
#include
উত্তরমুছুনint divisablecheck(int i,int j);
main()
{
int i,j=5;
printf("Enter the number for check if it is divisable by 5:");
scanf("%d",&i);
divisablecheck(i,j);
}
int divisablecheck(int m,int n)
{
if(m%n==0)
printf("divisable by 5");
else
printf("not divisable by 5");
return 0;
}
#include
উত্তরমুছুন#include
int funcx(int n);
int main()
{
int a,result;
printf("\n Enter number for check if it is divisable by 5 or not:");
scanf("%d",&a);
result=funcx(a);
getch();
return 0;
}
int funcx(int n)
{
int i=5;
if((n%i)==0)
printf("\n %d is divisable by %d",n,i);
else
printf("\n %d is not divisable by %d",n,i);
}
#include
উত্তরমুছুনmain()
{
int a,b=5;
scanf("%d",& a);
number(a,b);
}
int number(int c,int d)
{
if(c%d==0)
printf("The number is divisible by 5");
else
printf("Thr number is not by 5");
}
#include
উত্তরমুছুনvoid numcheck(int a)
{
if(a%5==0)
{
printf("The number '%d%' is divisible by 5",a);
}
else
{
printf("The number '%d%' is not divisible by 5",a);
}
}
void main()
{
int num;
printf("Enter the number: ");
scanf("%d",&num);
numcheck(num);
}
Id : 201430310
উত্তরমুছুনName : Mehrin
#include
using namespace std;
int number_dividable(int n)
{
int i=5;
if(n%5==0)
{
cout<<"The number is dividable by 5"<>n;
result = number_dividable(n);
return 0;
Md Bashir Fardoush
উত্তরমুছুনID: 201430385
Betch: 47th
/* wap a c program using function to check whether the given input is divisible by 5 or not. */
#include
using namespace std;
int divv(int n); /* prototype */
main(){ /* main body numb is variable for input*/
int numb,divisedf;
cout<<"Enter number: " ;
cin>>numb;
divisedf=divv(numb);
if(divisedf==0) cout<<" Dvisible by 5"<<endl;
else cout<<endl<<"Not divisible by 5"<<endl;
}
int divv(int n){ /* function dafinition*/
int t=1;
if(n%5==0) t=0;
return t;
}
Md bashir Fardoush
উত্তরমুছুনID: 201430385
Betch; 47th
/* WAP a program to find the area of a circle. use function to find area where area=pi*r^2. */
#include
#define pi 3.144
using namespace std;
float arr(float r);
int main(){
float radius;
float area;
cout<<"Enter Radious";
cin>>radius;
area=arr(radius);
cout<<"Area is:"<<area<<endl;
}
float arr(float r){
float area;
area=pi*r*r;
return area;
}
#include
উত্তরমুছুনusing namespace std;
int check_Divisible()
{
int m,n=5;
cin>>m;
return(m%n);
}
int main()
{
if(check_Divisible()==0)
cout<<"the number is Divisible";
else
cout<<"the number is not Divisible";
}
#include
উত্তরমুছুনusing namespace std;
void divisable (int a,int b)
{
if(a%b==0)
cout<<"dibisable by 5"<>x;
divisable(x,y);
}
Id-201210803
উত্তরমুছুন#include
using namespace std;
int numcheck(int a)
{
if(a%5==0)
cout<<"\n\nThe number is divisible by 5\n\n";
else
cout<<"\n\nThe number is not divisibel by 5 \n\n";
}
int main()
{
int num;
cout<<"Enter the number:";
cin>>num;
numcheck(num);
}
#include
উত্তরমুছুনusing namespace std;
class divisible_by_5
{
public:
int number;
divisible_by_5();
void show();
~divisible_by_5();
};
divisible_by_5::divisible_by_5()
{
cout<<"Enter a number which is to be checked: ";
cin>>number;
}
void divisible_by_5::show()
{
if(number%5==0)
cout<<endl<<number<<" is divisible by 5.";
else
cout<<endl<<number<<" is not divisible by 5.";
}
divisible_by_5::~divisible_by_5()
{
cout<<endl<<"DESTRUCTING";
}
main()
{
divisible_by_5 ob1,ob2;
ob1.show();
ob2.show();
}
#include
উত্তরমুছুনusing namespace std;
class number
{
public:
int n;
number();
void output();
~number();
};
number::number()
{
cout<<"Enter the number: ";
cin>>n;
cout<<endl;
}
void number::output()
{
if(n%5==0)
cout<<"DIVISIBLE..."<<endl;
else
cout<<"NOT DIVISIBLE..."<<endl;
}
number::~number()
{
}
int main()
{
number obj;
obj.output();
return 0;
}
cout<<endl;
উত্তরমুছুন}
void number::output()
{
if(n%5==0)
cout<<"DIVISIBLE..."<<endl;
else
cout<<"NOT DIVISIBLE..."<<endl;
}
number::~number()
{
}
int main()
{
number obj;
obj.output();
return 0;
}
#include
উত্তরমুছুনusing namespace std;
class fin2
{
public:
int n;
fin2(int n);
~fin2()
{
//cout<<"hghf";
}
};
fin2::fin2(int n)
{
for(int i=1;i<=n;i++)
if(i%5==0)
cout<>n;
fin2 appel(n);
}
using C++
উত্তরমুছুন#include
using namespace std;
class cons
{
public:
int number;
cons(int i);
~cons();
void result();
};
cons::cons(int i)
{
number = i;
}
void cons::result()
{
if (number == 0)
cout << "Enter correct number -- \n";
else if (number % 5 == 0)
cout << number << " Is dividable by 5 --\n";
else
cout << number << " Can not be dividable by 5 --\n";
}
cons::~cons()
{
cout << "[+]MEMPRY RELEASED[+]\n";
}
int main()
{
int num;
cout << "Enter that number you want to check --: ";
cin >> num;
cons obj(num);
obj.result();
return 0;
}
#include
উত্তরমুছুনusing namespace std;
class number
{
public:
int n;
number();
void output();
~number();
};
number::number()
{
cout<<"Enter the number:";
cin>>n;
}
void number::output()
{
if(n%5==0)
cout<<"Given number is divisible.."<<endl;
else
cout<<"Given number is not divisible.."<<endl;
}
number::~number()
{
}
int main()
{
number obj;
obj.output();
}
using c++
উত্তরমুছুনconstructor
#include
using namespace std;
class divisible
{
public:
int a;
divisible();
~divisible();
void result();
};
divisible::divisible()
{
cout<<"Enter a number :" ;
cin>>a;
}
divisible::~divisible()
{
}
void divisible::result()
{
if(a%5==0)
cout<<"This is divisible :"<<"\n";
else
cout<<"This is not divisible :";
}
int main()
{
divisible sb;
sb.result();
}
#include
উত্তরমুছুনusing namespace std;
class Divisible
{
public:
int num;
Divisible();
~Divisible()
{
cout<<"Distructor active";
}
int func()
{
if(num%5==0)
cout<<"The number is divisible"<>num;
}
int main()
{
Divisible obj;
obj.func();
return 0;
}
id:201510660
#include
উত্তরমুছুনusing namespace std;
class Divisible
{
public:
int num;
Divisible();
~Divisible()
{
cout<<"Distructor active";
}
int setu()
{
if(num%5==0)
cout<<"The number is divisible"<>num;
}
int main()
{
Divisible obj;
obj.setu();
return 0;
}
id:201510992
using c++
উত্তরমুছুন#include
using namespace std;
class cons
{
public:
int number;
cons(int i);
~cons();
void result();
};
cons::cons(int i)
{
number = i;
}
void cons::result()
{
if (number == 0)
cout << "Enter correct number -- \n";
else if (number % 5 == 0)
cout << number << " Is dividable by 5 --\n";
else
cout << number << " Can not be dividable by 5 --\n";
}
cons::~cons()
{
cout << "[+]MEMPRY RELEASED[+]\n";
}
int main()
{
int num;
cout << "Enter that number you want to check --: ";
cin >> num;
cons obj(num);
obj.result();
return 0;
}