def pour_water(juga, jugb):
print("%d\t%d" % (juga, jugb))
if jugb == fill:
print("Target achieved!")
return
elif jugb == max2:
pour_water(0, juga)
elif juga != 0 and jugb == 0:
pour_water(0, juga)
elif juga == fill:
pour_water(juga, 0)
elif juga < max1:
pour_water(max1, jugb)
elif juga < (max2 - jugb):
pour_water(0, juga + jugb)
else:
pour_water(juga - (max2 - jugb), jugb + (max2 - jugb))
max1 = int(input("Enter capacity of Jug A: "))
max2 = int(input("Enter capacity of Jug B: "))
fill = int(input("Enter target amount: "))
pour_water(0, 0)
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Sample</title>
</head>
<link rel="stylesheet" href="style.css" />
<style type="text/css">
body {
background-image: url('./hit.webp');
background-size: 8%;
background-repeat: no-repeat;
background-position: center center;
background-attachment: fixed;
background-color: pink;
}
a:link {
text-decoration: none;
color: orange;
}
a:visited {
text-decoration: none;
color: red;
}
a:hover {
text-decoration: underline;
color: blue;
}
a:active {
text-decoration: underline;
color: purple;
}
h3 {
color: green;
}
.c1 {
cursor: crosshair;
}
.c2 {
cursor: pointer;
}
.c3 {
cursor: move;
}
.c4 {
cursor: text;
}
.c5 {
cursor: wait;
}
.c6 {
cursor: help;
}
</style>
<body bgcolor="cyan">
<h1 style="color: blue; text-align: center">
CSS (Inline , Internal , External)
</h1>
<p>This paragraph is not styled</p>
<p class="left">This paragraph is styled by the class "Left"</p>
<p class="center">This paragraph is styled by the class "center"</p>
<p class="right">This paragraph is styled by the class "right"</p>
<b>This is Normal Bold</b> <br />
<b id="headline">This bold text is</b>
<h2>
<b><a href="https://www.pranabkr.in">This is a link</a></b>
</h2>
<h3 class="c1">The cursor over this ele is plus sign</h3>
<h3 class="c2">The cursor over this ele is pointing hand</h3>
<h3 class="c3">The cursor over this ele is a graspring hand</h3>
<h3 class="c4">The cursor over this ele is a I bar</h3>
<h3 class="c5">The cursor over this ele is a wait</h3>
<h3 class="c6">The cursor over this ele is a question mark</h3>
</body>
</html>// 1. The abstract class Vehicle has three subclasses named Car, Truck, and Motorcycle.
// Each vehicle type has a different fuel capacity. Each vehicle object has a unique
// registration number. Write an application that: Declares this class hierarchy, Instantiates
// several types of vehicles, Displays their details, Overrides the toString() method to return
// the vehicle type, registration number, and fuel capacity
abstract class vehicle {
double fuel;
String regino;
public vehicle(double fuel, String regino) {
this.fuel = fuel;
this.regino = regino;
}
public String toString() {
return "Vechile type: " + this.getClass().getSimpleName() + " Regi no: " + regino + "Fuel capacity: " + fuel + "Litters" ;
}
}
class Car extends vehicle {
public Car(double fuel , String regino){
super(fuel, regino);
}
}
class Truck extends vehicle {
public Truck(double fuel , String regino){
super(fuel, regino);
}
}
class Motorcycle extends vehicle {
public Motorcycle(double fuel , String regino){
super(fuel, regino);
}
}
public class Main {
public static void main(String[] args) {
Car c1 = new Car(10, "dh2112");
Truck T1 = new Truck(20, "eree2112");
Motorcycle M1 = new Motorcycle(40, "Dagsdh1o2");
System.out.println(c1.toString());
System.out.println(T1.toString());
System.out.println(M1.toString());
}
}#include <iostream>
using namespace std;
int main() {
int n, m;
cout << "Enter the row and col: " << endl;
cin >> n >> m;
int **ptr = new int *[n];
for (int i = 0; i < n; i++)
ptr[i] = new int[m]; // created 2D arr
cout << "Enter the val of the arr: " << endl;
for (int i = 0; i < n; i++)
for (int j = 0; j < m; j++)
cin >> ptr[i][j];
for (int i = 0; i < n; i++)
for (int j = 0; j < m; j++)
cout << ptr[i][j] << " ";
// cout << sizeof(ptr) << " " << endl;
// cout << sizeof(ptr[0]) << endl;
// clean up heep
for (int i = 0; i < n; i++)
delete[] ptr[i]; // delete mem of int[m]
delete[] ptr; // delete mem of int *[n]
return 0;
}
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Sample</title>
</head>
<link rel="stylesheet" href="style.css" />
<style type="text/css">
body {
background-image: url('./hit.webp');
background-size: 8%;
background-repeat: no-repeat;
background-position: center center;
background-attachment: fixed;
background-color: pink;
}
a:link {
text-decoration: none;
color: orange;
}
a:visited {
text-decoration: none;
color: red;
}
a:hover {
text-decoration: underline;
color: blue;
}
a:active {
text-decoration: underline;
color: purple;
}
h3 {
color: green;
}
.c1 {
cursor: crosshair;
}
.c2 {
cursor: pointer;
}
.c3 {
cursor: move;
}
.c4 {
cursor: text;
}
.c5 {
cursor: wait;
}
.c6 {
cursor: help;
}
</style>
<body bgcolor="cyan">
<h1 style="color: blue; text-align: center">
CSS (Inline , Internal , External)
</h1>
<p>This paragraph is not styled</p>
<p class="left">This paragraph is styled by the class "Left"</p>
<p class="center">This paragraph is styled by the class "center"</p>
<p class="right">This paragraph is styled by the class "right"</p>
<b>This is Normal Bold</b> <br />
<b id="headline">This bold text is</b>
<h2>
<b><a href="https://www.pranabkr.in">This is a link</a></b>
</h2>
<h3 class="c1">The cursor over this ele is plus sign</h3>
<h3 class="c2">The cursor over this ele is pointing hand</h3>
<h3 class="c3">The cursor over this ele is a graspring hand</h3>
<h3 class="c4">The cursor over this ele is a I bar</h3>
<h3 class="c5">The cursor over this ele is a wait</h3>
<h3 class="c6">The cursor over this ele is a question mark</h3>
</body>
</html>