2
Reply

Help me with triangle.

Sabaka Sabakow

Sabaka Sabakow

Dec 18 2011 7:23 AM
2k
Help me to run this.


using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args);
int Heron(int a, int b, int c)
    int p=(a+b+c)/2; 
    return sqrt(p*(p-a)*(p-b)*(p-c)); 
    
 
int main()
    int a,b,c; 
    Console.WriteLine << " a: "; 
    Console.ReadLine >> a; 
    Console.WriteLine << " b: "; 
    Console.ReadLine >> b; 
    Console.WriteLine << " c: "; 
    Console.ReadLine >> c; 
    if(a<=0 || b<=0 || c<=0){ 
        Console.WriteLine << " All values must be great from 0!\n"; 
        system("pause"); 
        return 1; 
    } 
    if(!(c<a+b) || !(a<b+c) || !(b<a+c))
    { 
       Console.WriteLine << "Triangle no exist!\n"; 
       system("pause"); 
       return 1; 
    } 
    else
    { 
        Console.WriteLine << "area triangle = " << Heron(a,b,c) << endl; 
        system("pause"); 
        return 0; 
    } 


}

Answers (2)