Please read carefully.
प्रोग्राम को समझने के लिए कुछ गणीत के फोर्मुले आना आवश्यक है जैसे किसी भी त्रिकोण की
hypotenuse निकालने का फ़ॉर्मूला है बाकि दो sides का square करना . दूसरा फ़ॉर्मूला sin thetaऔर cos theta के square का जोड़ 1 होता है.
/**
* यह प्रोग्राम कुछ Mathematical प्रॉब्लम को फलायेगा और उसका उत्तर स्क्रीन पर
* दिखायेगा . इसके बाद यह बताएगा की कंप्यूटर ने टास्क करने में कितना समय
* लिया.
*/
public class TimedComputation {
public static void main(String[] args) {
long startTime; // प्रोग्राम शुरू होने का समय, in milliseconds.
long endTime; // समय जब फलवत पूरी हो चुकी होगी , in milliseconds.
double time; // दोनो के बीच का समय, in seconds.
startTime = System.currentTimeMillis();
double width, height, hypotenuse; // त्रिकोन की sides
width = 40.0;
height = 15.0;
hypotenuse = Math.sqrt( width*width + height*height ); // सबसे लम्बी
// लाइन जिसे hypotenuse कहते है की फलावट
System.out.print("A triangle with sides 40 and 15 has hypotenuse ");
System.out.println(hypotenuse);
System.out.println("\nMathematically, sin(x)*sin(x) + "
+ "cos(x)*cos(x) - 1 should be 0.");
System.out.println("Let's check this for x = 1:");
System.out.print(" sin(1)*sin(1) + cos(1)*cos(1) - 1 is ");
System.out.println( Math.sin(1)*Math.sin(1)
+ Math.cos(1)*Math.cos(1) - 1 );
System.out.println("(There can be round-off errors when"
+ " computing with real numbers!)");
System.out.print("\nHere is a random number: ");
System.out.println( Math.random() );
endTime = System.currentTimeMillis();
time = (endTime - startTime) / 1000.0;
System.out.print("\nRun time in seconds was: ");
System.out.println(time);
} // main() का अंत
} // class TimedComputation का अंत