Answer:
Check the explanation
Explanation:
#include <bits/stdc++.h>
using namespace std;
class Rectangle{
public:
int length;
int breadth;
Rectangle(int l,int b){
length = l;
breadth = b;
}
int area(){
return length*breadth;
}
int perimeter(){
return 2*(length+breadth);
}
bool equals(Rectangle* r){
// They have the exact same length and width.
if (r->length == length && r->breadth == breadth)
return true;
// They have the same area
if (r->area() == area())
return true;
// They have the same perimeter
if (r->perimeter() == perimeter())
return true;
// They have the same shape-that is, they are similar.
if (r->length/length == r->breadth/breadth)
return true;
return false;
}
};
int main(){
Rectangle *r_1 = new Rectangle(6,3);
Rectangle *r_2 = new Rectangle(3,6);
cout << r_1->equals(r_2) << endl;
return 0;
}
Answer:
Código Java de forma recursiva que nos ayuda a calcular el factorial de ... El factorial de un número es la multiplicación de los número que van del ... Para expresar el factorial se suele utilizar la notación n! ... mayo 5, 2010 - 4:13 am ... un programa q de un numero dado en arabigo o romano lo imprima ya
Explanation:
Espero te sirva!!
Answer:
public class num9 {
public static void main(String[] args) {
int sum =0;
int num =5;
for(num =5; num<=500; num+=5){
System.out.println(num);
sum +=num;
}
System.out.println(sum);
}
}
Explanation:
- Declare and initialize the variables sum and num
- Use a for loop with the condition for(num =5; num<=500; num+=5) Since the loop will increment by 5 and run from 5 to 500
- Within the loop, add num to sum at each iteration
- Print all elements on seperate lines
- Outside the loop, print the final value of sum
Create a for loop
Answer:
Explanation:
It knows how to remember data and where to find that data. In other words, it knows how the raw memory works. (RAM).
It understands how to make a program run within the confines of its logical steps in an order that makes the program work the way the user intends.
It can be made to display short cuts, or any icon or picture (not an obvious talent).
It can search for unwanted intruders like ads or viruses.
It can can time events even to the point of getting your coffee ready for you with the proper add on.
Answer:
Module Program
Sub Main()
Dim num As Integer
num = 4
Console.WriteLine("The square of " & num & " is " & num * num)
Console.ReadKey()
End Sub
End Module
Explanation:
Very similar to the other program you posted.