Showing posts with label Source code. Show all posts
Showing posts with label Source code. Show all posts

Sunday, 10 June 2012

code of area of the triangle by using sides


This is the source code of area of the triangle by using sides
#include<iostream.h>
#include<conio.h>
#include<math.h>
 int main()
 {
     float a,b,c,S,Area;
     cout<<"enter the value of first side:";
     cin>>a;
       cout<<"enter the value of second side:";
       cin>>b;
         cout<<"enter the value of third side:";
         cin>>c;
         S=(a+b+c)/2;
         Area=sqrt(S*(S-a)*(S-b)*(S-c));
         cout<<"this is the required area:"<<Area;
         getch();
         }
End

C++ Program for conversion of Kg to g.



 This is the program for conversion of Kg to g.
// Program for conversion of Kg to g.
#include<iostream.h>
main()
{
      float kg,g;
      cout<<"Please Enter the value in Kg:";cin>>kg;
      cout<<"\n";
      g = kg / 1000;
      cout<<"The value of the g is:"<<g;
      cout<<"\n";
      system("Pause");
      }
End

source code of c++(checks for an even number)






The source code of c++(checks for an even number)

//  checks for an even number
#include <iostream>
using namespace std;

int main(){
   int num;
   cout << "Give me any number: ";
   cin >> num;

   if (num % 2 == 0) {
       cout << "It's even!" << endl;
   }else{
       cout << "It's odd!" << endl;
   }

  system("pause");
}
End

C++ source code for sum,pro,sub,mul,mod.



This is the C++ source code for sum,pro,sub,div,mod.



#include<iostream.h>
#include<conio.h>
 int main()
 {
     int x,y,sum,pro,sub,div,mod;
     x=10;
     y=5;
     sum=x+y;
     pro=x*y;
     sub=x-y;
     div=x/y;
     mod=x%y;
   
     cout<<"sum of x and y="<<sum<<endl;
     cout<<"pro of x and y="<<pro<<endl;
     cout<<"sub of x and y="<<sub<<endl;
     cout<<"div of x and y="<<div<<endl;
     cout<<"mod of x and y="<<mod<<endl;
     getch();
     }
   
End