Sunday, 15 September 2013

PROGRAM TO FIND THE POSSIBLE PRIME FACTORS OF THE ENTERED NUMBER

/*MADE BY KRISHNA AGARWAL*/
#include<iostream>
using namespace std;
int main()
{
    int num,i,j=2,k;
    cout<<"enter the nubmer\n";
    cin>>num;
    cout<<"the result is \n";
    while(num>1)
    {
        if(num==0||num==1)
            cout<<"\nno possible prime factors for the entered number\n";
        else
        {
            if(num%j==0)
            {
                cout<<j<<"\n";
                num=num/j;
            }
            else
                j++;
        }
    }
}

PROGRAM TO PRINT THE SERIES OR THE PRIME NUMBERS

/*MADE BY KRISHNA AGARWAL*/
#include<iostream>
using namespace std;
int main()
{
    int terms,i,j=2,k,num;
    cout<<"\nenter the number till which you want the prime numbers\n";
    cin>>terms;
    for(num=2;num<terms;num++)
    {
        j=2;
        while(num>1)
        {
            if(num%j==0)
                break;
            else
                j++;
        }
        if(j==num)
            cout<<num<<" ";
    }
    return 0;
}

Wednesday, 24 July 2013

PROGRAM TO FIND THE GREATEST NUMBER AMONG THREE

//PROGRAM TO FIND THE GREATEST NUMBER AMONG THREE
/*MADE BY KRISHNA AGARWAL*/
#include<iostream>
using namespace std;
int main()
{
    int a,b,c;
    float k;
    cout<<"enter the marks of english\n";
    cin>>a;
    cout<<"enter the marks of hindi\n";
    cin>>b;
    cout<<"enter the value of maths\n";
    cin>>c;
    if(c>b)
    {
        if(c>a)
        cout<<"student score highest in maths\n";
    }
    else
        if(b>a)
            cout<<"student score highest in hindi\n";
        else
            cout<<"student score highest in english\n";
    k=(a+b+c)/3             ;
    cout<<"the % scored is\t\n "<<k;
    return 0;
}

PROGRAM OF TEMPERATURE CONVERSION

//PROGRAM OF TEMPERATURE CONVERSION
/*MADE BY KRISHNA AGARWAL*/
#include<iostream>
using namespace std;
int main()
{
    float c,f;
    cout<<" enter the temperature in farhenhiet:\t";
    cin>>f;
    c=(5*(f-32))/9;
    cout.precision(3);
    cout<<" the temprature in celcius is:\t"<<c;
    return 0;
}



PROGRAM OF EVEN/ODD

//PROGRAM OF EVEN/ODD
/*MADE BY KRISHNA AGARWAL*/
#include<iostream>
using namespace std;
int main()
{
    int n;
    cout<<"enter the value of n\n";
    cin>>n;
    if(n%2==0)
    cout<<"n is even no.";
    else
    cout<<"n is odd no.";
    return 0;
}

SIMPLE PROGRAM TO ADD TWO NUMBERS

//SIMPLE PROGRAM TO ADD TWO NUMBERS
/*MADE BY KRISHNA AGARWAL*/
#include<iostream>
using namespace std;
int main()
{
    int a,b,c;
    cout<<"enter the value of a=";
    cin>>a;
    cout<<"enter the value of b=";
    cin>>b;
    c=a+b;
    cout<<"the sum is="<<c;
    return 0;
}

PROGRAM TO MULTIPLY TWO NUMBERS

//PROGRAM TO MULTIPLY TWO NUMBERS
/*MADE BY KRISHNA AGARWAL*/
#include<iostream>
using namespace std;
int main()
{
    int a,b,c;
    cout<<"emter the value of a\n";
    cin>>a;
    cout<<"enter the value of b\n";
    cin>>b;
    c=a*b;
    cout<<"the product of two noumbers is\n"<<c;
    return 0;
}