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..

Friday, 17 August 2012

QUEUE IMPLEMENTATION using LINKED LIST

Here i attached the program codings of Queue Implementation using linked list....!

Hopeit will be helpful..! :)


#include<stdio.h>
#include<conio.h>
#include<malloc.h>
struct node
{
    int data;
    struct node *next;
} *front, *rear;
void enqueue(int ele);
int dequeue();
void display();
int main()
{
    int ch, ele;
    rear = NULL;
    front = NULL;
    while (1)
    {   printf("\n***QUEUE IMPLEMENTATION USING LINKED LIST*** \n");
        printf("************ Menu ***************");
        printf("\nEnter:\n1 . Enqueue (INSERTION)\n2 . Dequeue (DELETION)\n3 . Display\n4 . Exit\n");
        printf("Enter your choice :: ");
        scanf("%d", &ch);
        switch (ch)
        {
            case 1:
            printf("Enter The Element Value\n");
            scanf("%d", &ele);
            enqueue(ele);
            break;
            case 2:
            ele = dequeue();
            printf("The deleted element = %d\n", ele);
            break;
            case 3:
            display();
            break;
            case 4 :
            exit(0);
            break;
            default:
            printf("Invalid choice..!");
            getch();
            break;
        }
    }
}
void enqueue(int ele)
{
    struct node *p;
    p = (struct node*)malloc(sizeof(struct node));
    p->data = ele;
    p->next = NULL;
    if (rear == NULL || front == NULL)
    front = p;
    else
    rear->next = p;
    rear = p;
    display();
}
int dequeue()
{
    struct node *p;
    int ele;
    if (front == NULL || rear == NULL)
    {
        printf("\nUnder Flow");
        getch();
        exit(0);
    }
    else
    {
        p = front;
        ele = p->data;
        front = front->next;
        free(p);
    }
    return (ele);
    display();
}
void display()
{
    struct node *t;
    t = front;
    while (front == NULL || rear == NULL)
    {
        printf("\nQueue is empty");
        getch();
        exit(0);
    }
    while (t != NULL)
    {
        printf("->%d", t->data);
        t = t->next;
    }
}

Wednesday, 15 August 2012

really amazing..!


its really interesting friends..!
i created this blog only 2 days ago..!
but it reached 151 pageviews today..!
really happy..!new experience