Computer Science, asked by dibyendu16, 7 months ago

{tex|)\boxed\mathbf{100 POINTS}(/tex) NO COPY PAST(REPORT=DELETE UR ANSWER) ITS URGENT ANSWER FAST Write a program to create a class Force with the data members / instance variables M (to store mass of an object) and A (to store the acceleration). Define a method void Input( int ma, int ac) to assign parameters 'ma' to M and 'ac' to A. Another method double calculate( ) to calculate the force value after doing the calculation( force = Mass x acceleration) and return force value. Also define main method to accept the mass value of an object and acceleration value. Create suitable object of the class and call the functions/ methods to print the output

Answers

Answered by Anonymous
0

#include<iostream.h>

#include<conio.h>

class Force

{

float M;

float A;

public:

void Input(int ma,int ac)

{

M=ma;

A=ac;

}

double calculate ( )

{

return MxA;

};

void main( )

{

clrscr();

Force obj1;

obj1.Input(2,3);

cout<<"Force="<<obj1.calculate();

getch();

}

____________________________

Answered by avitaylor101
0

Answer:

r=int(input("Enter upper limit: "))

for a in range(2,r+1):

k=0

for i in range(2,a//2+1):

if(a%i==0):

k=k+1

if(k<=0):

print(a)

Modify this a bit

Similar questions