cursor

pictures

Wednesday, 5 September 2012

program to check whether the given number is prime or not

hello keerthi...u asked me right..?
here is the solution for ur doubt in "to check whether the given number is prime or not...?"....in c++

note: 
        (1). the words with red color letters are comments to understand the concept..need not include it in program...ok..?
        (2). prime number is the number which is divisible by 1 and by itself...like 1,2,3,5,7,11,13,17,19,23..etc...so have this logic in ur mind and write the program..definetly u finds it easy...here is the program.,hope it is helpful..


PROGRAM CODING:
#include<iostream.h>
#include<conio.h>
int main()
{
    int flag;
    int n,i;
    cout<<"Enter the number:"; /*you are getting number from the user here*/
    cin>>n;
    if(n<=3)/*if it is 0,1,2,3--it will be obviously prime number.,so we are declaring this as prime*/
    cout<<"The number is a prime number";
    else
    for(int i=2;i<n/2;i++)/*these steps are checkin whthr the given no. is divisible by othr no.s or not.,(continue)*/
    {if(n%i==0)
    {
    flag=0;/*if yes.,it will print "it is not a prime"*/
    break;
    }
    else
    flag =1;/*if not.,it will print"it is a prime"*/
    }if(flag==1)
    cout<<"The given number is a prime number";
    else
    cout<<"The given number is not a prime number";
    getch();
}

Sunday, 2 September 2012

FOR FIRST YEAR STUDENTS

Hi my dear juniors---First year students...!
if u have any problem in programming in FOC ...!
or understanding any concepts in first year anna univ (chennai)syllabus...!

step 1==>see ""contacts"" in the ''pages'' bar on the right side or click here (contact me)


step 2==>fill ur details in it..("IT WILL BE HIDDEN")..so u r completely
safe

step 3==>fill ur status & den ask ur questions and doubts in the comment bar...

for further queries.,mail me to gowrimani28@gmail.com..I'll help u for sure..! :)

feel free to ask ur doubts in studies..