Saturday, September 7, 2013

Monday, September 2, 2013

stack programme using structure in C

#include<stdio.h>
#include<stdlib.h>
#define structsize 10
struct stack
{
    int top;
    int item[structsize];
};
void push(struct stack *ps)
{
    int element;
    printf("\npush an element:");
    scanf("%d",&element);
    if(ps->top==(structsize-1)){

    printf("overflow\n");
    exit(0);
    }
    else
    {
       
    ps->item[++ps->top]=element;

    }

}
void pop(struct stack *ps)
{
    int element;
    if(ps->top==-1){
    printf("underflow flow\n");
    exit(0);   
    }
    else
    {
       
    element=ps->item[ps->top];
    ps->top--;
    printf("\npoped element is :%d",element);
    }

}
void display(struct stack *ps)
{
    int i;
    printf("\ncurrent stack is:\n");
    for(i=0;i<=(ps->top);i++)
    {
        printf("\n %d",ps->item[i]);
    }
}
int main()
{
int arr[50],ch;
struct stack s;
s.top=-1;
while(1)
{
printf("\n\nEnter \n1: push\n2:pop\n3:print stack \n4:exit \n\n enter choice:");
scanf("%d",&ch);
    switch(ch)
    {
        case 1:push(&s);
            break;
        case 2:pop(&s);
            break;
        case 3:display(&s);
            break;
        default:exit(0);
    }

}

return 0;
}

Sunday, September 1, 2013

How to find execution time of program in C??

We always eager to know that how much time my program takes to give me output. As a good programmer you always worry about the time complexity. If you print your execution time along with output then you can check your execution time for different test cases. It's really exiting.


#include<stdio.h>
#include<time.h>
int main()
{
clock_t begin, end;
begin = clock();
double time_spent;

/*
     write your code
*/

end = clock();
time_spent = (double)(end - begin) / CLOCKS_PER_SEC;
printf("\n execution time for sorting: %f seconds ",time_spent);

return 0;

}

Thursday, August 15, 2013

Motherboard

What is a motherboard ??


A motherboard (also known as the mainboard, system board, planar board or logic board) is the main PCB found in computers and other expandable systems. It holds many of the crucial electronic components of the system, such as the CPU, memory, and processor.
motherboard

The function of the computer motherboard is to act as the main circuit board that connects and communicates to all the devices and components attached. The motherboard also facilitates the communication of devices with each other. Motherboards are designed around the type of central processing unit (CPU) that will be installed. Because motherboards act as the base for all other computer components, the number of PCI slots, USB headers, memory slots, SATA headers, and other slots should be checked ahead of time before building a personal computer.

A typical desktop computer has its microprocessor, main memory, and other essential components connected to the motherboard. Other components such as external storage, controllers for video display and sound, and peripheral devices may be attached to the motherboard as plug-in cards or via cables, in modern computers it is increasingly common to integrate some of these peripherals into the motherboard itself.


An important component of a motherboard is the microprocessor's supporting chipset, which provides the supporting interfaces between the CPU and the various buses and external components. This chipset determines, to an extent, the features and capabilities of the motherboard.

What are the reasons for mother board failure? 

  1. First and most common reason is heat. Keep cabinet ventilated to prevent high temperature inside the box.
  2. Check your Fan speed, if it is not normal then hurry up!! repair it.
  3. Dust also cause problems. clean your pc regularly and prevent it from the dust environment.
  4. Use static power supply, put power controller to prevent your pc from unregulated ac power supply.
  5. Do not install the software that cause damage your system. Use only trusted and light software if possible. 
  6. Do not play the games which require high processing power ( before installation, see whether it is suitable to your configuration or not.)   
  7. Keep your pc free from viruses and worms , they put extra overload on processor.
  8. When everything is going well, don't ever upgrade BIOS without right upgrade files.
  9. Do not play with BIOS and RAM if you don't know properly about it.


    Thursday, August 1, 2013

    How to terminate processes in ubuntu??

    In windows we can easily terminate the process by
    • ctrl+alt+del 
    • right click on program name
    • go to process
    • end process.
    but in Linux , it is not that much easy, u have to follow the terminal steps:

    example: to close firefox process.
    • Open terminal (ctrl+alt+t)
    • type command : ps auxwww | grep firefox
    • u will get some table , in which u find process IDs
    • type command : kill 2348 (note: 2384 is process id, it is different each time )
    Kill process is very useful when your program is not responding.

    Tuesday, July 30, 2013

    All android versions and their names

    Android 1.5 Cup Cake
    •  Android 1.5 =  Cupcake
    •  Android 1.6 Donut
    •  Android 2.0/2.1 Eclair
    •  Android 2.2 = Froyo
    •  Android 2.3 = Gingerbread
    •  Android 3.0/3.1/3.2 = Honeycomb
    •  Android 4.0 = Ice Cream Sandwich
    •  Android 4.1/4.2/4.3 = Jelly Bean
    •  Android 5.0 = Lime Pie    

    Android
     
    Android 1.5 Cup Cake

    Sunday, July 28, 2013

    To print indian map in "c" langauge

    #include<stdio.h>
    #include<conio.h> //for windows only
    void main()
    {
    int a,b,c;
    for (b=c=10;a="- FIGURE?, UMKC,XYZHello Folks,\
    TFy!QJu ROo TNn(ROo)SLq SLq ULo+\
    UHs UJq TNn*RPn/QPbEWS_JSWQAIJO^\
    NBELPeHBFHT}TnALVlBLOFAkHFOuFETp\
    HCStHAUFAgcEAelclcn^r^r\\tZvYxXy\
    T|S~Pn SPm SOn TNn ULo0ULo#ULo-W\
    Hq!WFs XDt!" [b+++21]; )

    {
    for(; a-- > 64 ; )
    {
    putchar ( ++c=='Z' ? c = c/ 9:33^b&1);
    }
    }
    }
    India map
     

    Thursday, July 25, 2013

    Problem : Firefox is responding very late

    many of you might facing a problem with  " Firefox web browser" that it responding too late, even input from keyword is also not taking well etc...

    I got one solution, after doing this my browser responding nicely.

    • Go to tools->add-ones->Extention
    • Remove all your video and Flash plug-ins ..
    • restart the Firefox
    now enjoy original fast firefox...
    Firefox

    Tuesday, July 23, 2013

    Don't use Free() more than once for same pointer

    To use Free() more than once cause a "FATAL ERROR" .
    "FATAL ERROR" cause CRASH the program,
    and because of which we get a segmentation fault as error...

    sometime it also make problem when we are doing program in group. one member frees the pointer while actually another fellow is using same pointer.
    so never try to use Free() more than once for same pointer.  

    Wednesday, July 17, 2013

    How to install java in ubuntu??

    • First start your terminal ( if not found on desk top try shortcut key ctrl+alt+T)
    • make sure you are connected to the internet.
    • update your Ubuntu by the command : sudo apt-get update
    • then install java (jdk and jre) by the command :
      sudo apt-get install openjdk-6-jdk openjdk-6-jre
    • To check if java has been installed in your system, type the following command:

      javac -version