A blog to help students to learn programming in various languages including C, C++, Java, Python and many more.

Subscribe For Free Latest Updates!

We'll not spam mate! We promise.

Showing posts with label math. Show all posts
Showing posts with label math. Show all posts

Saturday, 23 January 2016


Program Screenshot
Output

#include <iostream>
#include <math.h>
using namespace std;
int main()
{
int a,b,c,d=0,x;
cout<<"Enter a,b & c:";
cin>>a>>b>>c;
d=(b*b)-4*a*c;
cout<<"Result:\n";
if(d<0) {
cout<<"d<0"<<endl;
cout<<(-b-sqrt(d))/2*a<<endl;
cout<<(-b+sqrt(d))/2*a<<endl;
} else if(d==0) {
cout<<"D=0"<<endl;
cout<<-b/2*a<<endl;;
} else {
cout<<"D>0"<<endl;
cout<<"Imaginary number: "<<endl;
}
}

Read More >>

Monday, 18 January 2016


Program ScreenShot
Output

#include <iostream.h>

using namespace std;
int main()
{
   int n, i = 3, count, c;
   cout<<"Enter the number of prime numbers required: ";
   cin>>n;
   if ( n >= 1 ) {
      cout<<"First "<<n<<" prime numbers are:\n";
      cout<<"2\n";
   }
   count = 2 ;
   while (count <= n) {
      for ( c = 2 ; c <= i - 1 ; c++ ) {
         if ( i%c == 0 )
            break;
      }
      if ( c == i ) {
         cout<<i<<"\n";
         count++;
      }
      i++;
   }
   return 0;
}
Read More >>

Saturday, 16 January 2016


Program ScreenShot

#include<iostream>
using namespace std;
int main()
{
int a[100][100];
int r,c;
cout<<"Enter no. of rows & columns: ";
cin>>r>>c;;
cout<<"Enter "<<r*c<<" values : ";
for(int i=0;i<r;i++) {
for(int j=0;j<c;j++) {
cin>>a[i][j];
}
}
for(int i=0;i<r;i++) {
for(int j=0;j<c;j++) {
a[i][c]+=a[i][j];
}

}
for(int i=0;i<r;i++) {
for(int j=0;j<c+1;j++) {
a[r][j]+=a[i][j];
}

}
cout<<"SUM : "<<"\n";
for(int i=0;i<r+1;i++) {
for(int j=0;j<c+1;j++) {
cout<<a[i][j]<<" ";
}
cout<<"\n";
}
}

Read More >>


Copyright © 2016 - ProgrmIt - All Rights Reserved
(Articles Cannot Be Reproduced Without Author Permission.)
Design By : | Powered By: Blogger