Question 6 : Write a program in Java to classify a triangle whether it is equilateral, isosceles, or scalene on the basis of the values of the three sides given by the user.
Java Program :
public class triangles
{
public static void main(int a,int b,int c)
{
if (a==b && b==c)
System.out.println("The triangle with sides "+a+","+b+","+c+" is an equilateral one");
if ((a==b && b!=c && a!=c) || (b==c && b!=a && c!=a) || (c==a & c!=b && a!=b))
System.out.println("The triangle with sides "+a+","+b+","+c+" is an isosceles one");
if (a!=b && a!=c && b!=c)
System.out.println("The triangle with sides "+a+","+b+","+c+" is a scalene one");
}
}
Input :
(i) a=10
b=10
c=10
(ii) a=10
b=10
c=20
(iii) a=10
b=15
c=20
Output :
(i) The triangle with sides 10,10,10 is an equilateral one
(ii) The triangle with sides 10,10,20 is an isosceles one
(iii) The triangle with sides 10,15,20 is a scalene one
Java Program :
public class triangles
{
public static void main(int a,int b,int c)
{
if (a==b && b==c)
System.out.println("The triangle with sides "+a+","+b+","+c+" is an equilateral one");
if ((a==b && b!=c && a!=c) || (b==c && b!=a && c!=a) || (c==a & c!=b && a!=b))
System.out.println("The triangle with sides "+a+","+b+","+c+" is an isosceles one");
if (a!=b && a!=c && b!=c)
System.out.println("The triangle with sides "+a+","+b+","+c+" is a scalene one");
}
}
Input :
(i) a=10
b=10
c=10
(ii) a=10
b=10
c=20
(iii) a=10
b=15
c=20
Output :
(i) The triangle with sides 10,10,10 is an equilateral one
(ii) The triangle with sides 10,10,20 is an isosceles one
(iii) The triangle with sides 10,15,20 is a scalene one
Case ii (a=10,b=10,c=20) can not be an isosceles triangle. To be a triangle, addition of any two sides must be greater that the third side.
ReplyDeleteimport java .util.*;
ReplyDeletepublic class Triangle
{
public static void main()
{
Scanner sc= new Scanner(System.in);
System.out.println("enter the side ab");
int ab=sc.nextInt();
System.out.println("enter the side bc");
int bc=sc.nextInt();
System.out.println("enter the side ac");
int ac=sc.nextInt();
if( ab == bc)
{
if(bc==ac)
{
System.out.println("eqilateral");
}
}
if( ab ==bc)
{
if(bc>ac)
{
System.out.println("isoceles");
}
}
if( ab != bc)
{
if(bc != ac)
{
System.out.println("scalen");
}
}
}
}
its a perfect program
Deleteimport java .util.*;
ReplyDeleteclass Triangle
{
public static void main(String args[])
{
Scanner sc= new Scanner(System.in);
System.out.println("enter the side ab");
int ab=sc.nextInt();
System.out.println("enter the side bc");
int bc=sc.nextInt();
System.out.println("enter the side ac");
int ac=sc.nextInt();
if( a==b&& b==c&&c==a)
System.out.println("equilateral");
else if (a==b||b==c||c==a)
System.out.println("isosceles");
else
System.out.println("Scalene");
}
}
Saale bahancho bhaadiya program hai bahas ki chuut
ReplyDeleteOn basis of their angle and side write a program to find type of triangle
ReplyDeletePerfect one
ReplyDeleteHidkkdofutbk
ReplyDeleteBurdur
ReplyDeleteGiresun
Sakarya
Artvin
Mardin
JNVE
Balıkesir
ReplyDeleteBursa
Mersin
Konya
Van
G3MPİX
görüntülü
ReplyDeleteucretli show
XEPLG
Adıyaman Lojistik
ReplyDeleteTrabzon Lojistik
Muğla Lojistik
Bayburt Lojistik
Bayburt Lojistik
8WO2
AF649
ReplyDeleteIğdır Şehir İçi Nakliyat
Trabzon Parça Eşya Taşıma
Tunceli Şehirler Arası Nakliyat
Batman Parça Eşya Taşıma
Trabzon Lojistik
Çerkezköy Korkuluk
Muğla Lojistik
Çerkezköy Ekspertiz
Pursaklar Fayans Ustası
61FCE
ReplyDeletebinance %20 komisyon indirimi
1E4B3
ReplyDeletekastamonu bedava sohbet siteleri
düzce sesli görüntülü sohbet
denizli canlı sohbet odaları
hatay en iyi görüntülü sohbet uygulaması
çankırı bedava sohbet siteleri
goruntulu sohbet
ardahan canlı sohbet siteleri ücretsiz
parasız sohbet
kayseri görüntülü canlı sohbet
7CBF3
ReplyDeletehatay bedava sohbet chat odaları
kırklareli ücretsiz sohbet odaları
tekirdağ görüntülü sohbet
sakarya bedava sohbet odaları
tunceli görüntülü canlı sohbet
ücretsiz sohbet siteleri
sinop sesli sohbet sitesi
canli sohbet chat
ankara görüntülü sohbet kızlarla
5C82F
ReplyDeleteaksaray en iyi sesli sohbet uygulamaları
ankara en iyi görüntülü sohbet uygulamaları
burdur canlı sohbet et
antalya rastgele sohbet
Bilecik Mobil Sohbet Sitesi
Aydın Rastgele Görüntülü Sohbet
görüntülü canlı sohbet
hatay görüntülü sohbet
zonguldak canlı sohbet et
1CFD2
ReplyDeleteErgo Coin Hangi Borsada
Kripto Para Madenciliği Siteleri
Spotify Takipçi Satın Al
Kripto Para Madenciliği Nedir
Binance Referans Kodu
Keep Coin Hangi Borsada
Pinterest Takipçi Satın Al
Bitcoin Para Kazanma
Binance Komisyon Ne Kadar
4A1EF
ReplyDeletesushi
ledger live
phantom
defillama
poocoin
dappradar
solflare
uniswap
trezor suite
SDEFVVGBFD
ReplyDeleteتسليك مجاري بالقطيف
retgryhgrtyhtyu
ReplyDeleteعزل اسطح بالجبيل
شركة تنظيف خزانات بالبكيرية oXzEXiKmJ7
ReplyDeleteشركة صيانة افران بالاحساء rWStfgMBlD
ReplyDeleteشركة تنظيف سجاد بالجبيل yWP5UCojRF
ReplyDeleteشركة تنظيف مجالس بخميس مشيط CYak06OG46
ReplyDelete<a href="https://alryan-services.com.sa/%d8%b4%d8%b1%d9%83%d8%a9-%d8%b9%d8%b2%d9%84-%d8%a7%d8%b3%d8%b7%d8%ad-%d8%a8%d8%a7%d9%84%
ReplyDeleteشركة تنظيف سجاد بجازان yGY91hrra9
ReplyDelete