using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace random1
{
class Program
{
static void Main()
{
F();
F();
F();
F();
F();
F();
}
static Random r = new Random();
static void F()
{
for(int i = 0; i < 600; i++)
{
double value;
double n = 0.5 + r.NextDouble() * (6.0-0.5);
value = Math.Round(n);
Console.WriteLine(value);
}
Console.ReadLine();
}
}
}
Jumat, 31 Mei 2013
Menghitung sisi Segitiga
public class sisiSegitiga {
public static void main(String[] args) {
double sudutA, sudutB, sudutC, sisi1, hasil,tes, tes1, tes2;
sudutA = 30;
sudutB = 60;
sudutC = 45;
sisi1 = 2;
tes = Math.sin(sudutA);
System.out.println("tes: " + tes);
tes1 = Math.sin(sudutB);
System.out.println("tes1: " + tes1);
tes2 = Math.sin(sudutC);
System.out.println("tes1: " + tes2);
if (sudutA != 0) {
hasil = (sisi1 * Math.sin(sudutA)) / Math.sin(sudutB);
System.out.println("sisi yang lain: " + hasil);
} else if (sudutB != 0) {
hasil = (sisi1 * Math.sin(sudutB)) / Math.sin(sudutC);
System.out.println("sisi yang lain: " + hasil);
} else if (sudutC != 0) {
hasil = (sisi1 * Math.sin(sudutC)) / Math.sin(sudutA);
System.out.println("sisi yang lain: " + hasil);
}
}
}
Langganan:
Postingan (Atom)