write a progra in c++ using class & object to find out
wheather a given no. is prim or not.
Answer Posted / rakesh ranjan
#include<conio.h>
void main()
{
int a,i;
printf("enter the number ");
scanf("%d",&a);
for(i=2;i<a;i++)
if(a%i==0)
{
printf("number is not Prime");
break;
}
if(i==a)
printf("Prime number");
getch();
}
Is This Answer Correct ? | 16 Yes | 6 No |
Post New Answer View All Answers
Whats is abstraction in oops?
How do you achieve runtime polymorphism?
What is the difference between static polymorphism and dynamic polymorphism?
Can an interface inherit a class?
What is oops?what is its use in software engineering?
How many human genes are polymorphic?
They started with the brief introduction followed by few basic C++ questions on polumorphism, inheritance and then virtual functions. What is polymorphims? How you will access polymorphic functions in C? How virtual function mechanism works?
What is inheritance and how many types of inheritance?
What is a class in oop?
Write a program to implement OOPS concepts such as inheritance, polymorphism, friend function, operator overloading?
what is difference between class template and template class?
Can you inherit a private class?
What are the 3 pillars of oop?
Which language is not a true object oriented programming language?
What are two types of polymorphism?