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
what are the ways in which a constructors can be called?
What are oops methods?
What is abstraction in oop with example?
What is abstraction oop?
hi all..i want to know oops concepts clearly can any1 explain??
Why is abstraction used?
What is stream in oop?
why reinterpret cast is considered dangerous?
Are polymorphisms mutations?
What is class and object with example?
What is destructor give example?
Why do we use class in oops?
Question: Write a program that prints a paycheck. Ask the program user for the name of the employee, the hourly rate, and the number of hours worked. If the number of hours exceeds 40, the employee is paid “time and a half”, that is, 150 percent of the hourly rate on the hours exceeding 40. Be sure to use stepwi se refine ment and break your solution into several functions. Use the int_name function to print the dollar amount of the check.
How oops is better than procedural?
Following are the class specifications: class {int a}; class {int b}; Using friend funtion,calculate the max of two objects and display it.