Friday, December 10, 2010

C data Input and Output

#include <stdio.h>
int main(void)
{
    int anika;
    int jakir;
    printf("Please give the value of Anika:\n");
    scanf("%d",&anika);
    printf("Please give the value of Jakir:\n");
    scanf("%d",&jakir);
    printf("The addition is: %d\n", anika+jakir);
    printf("The Subtraction is: %d\n", anika-jakir);
    printf("The Multiplication is: %d\n", anika*jakir);
    printf("The Division is: %d\n", anika/jakir);
    system("pause");
    return 0;
}

Friday, December 10, 2010

Oprerators and Expressions

#include 
int main(void)
{
    int anika=10;
    int jakir=5;
    printf("The addition is: %d\n", anika+jakir);
    printf("The Subtraction is: %d\n", anika-jakir);
    printf("The Multiplication is: %d\n", anika*jakir);
    printf("The Division is: %d\n", anika/jakir);
    system("pause");
    return 0;
}


This is the output:

The addition is: 15
The addition is: 5
The addition is: 50
The addition is: 2

Friday, December 10, 2010

Using Pointer in a C Program

#include <stdio.h>
int main(void)
{
    int *p;
    int anikas_son=2;
    p=&anikas_son;
    printf("%d\n",*p);
    system("pause");
    return 0;
}


This is the output:

2

Friday, December 10, 2010

Using Do While loop in a C Program

#include <stdio.h>
int main(void)
{
    int i=0;
    do
    {
    printf("JAKIR:\tI LOVE YOU ANIKA\n");
    i++;
    }while(i<=5);
    system("pause");
    return 0;
}

This is the output:
JAKIR:  I LOVE YOU ANIKA
JAKIR:  I LOVE YOU ANIKA
JAKIR:  I LOVE YOU ANIKA
JAKIR:  I LOVE YOU ANIKA
JAKIR:  I LOVE YOU ANIKA
JAKIR:  I LOVE YOU ANIKA

Friday, December 10, 2010

Using While loop in a C Program

#include <stdio.h>
#include 
int main(void)
{
    int i=0;
    while(i<=5)
    {
    printf("JAKIR:\tI LOVE YOU ANIKA\n");
    i++;
    }
    system("pause");
    return 0;
}


This is the output:
JAKIR:  I LOVE YOU ANIKA
JAKIR:  I LOVE YOU ANIKA
JAKIR:  I LOVE YOU ANIKA
JAKIR:  I LOVE YOU ANIKA
JAKIR:  I LOVE YOU ANIKA
JAKIR:  I LOVE YOU ANIKA

Friday, December 10, 2010

Using For loop in a C Program

#include <stdio.h>
int main(void)
{
    int i;
    for(i=0;i<5;i++)
    {
    printf("JAKIR:\tI LOVE YOU ANIKA\n");
    }
    system("pause");
    return 0;
}
This is the output:
JAKIR:  I LOVE YOU ANIKA
JAKIR:  I LOVE YOU ANIKA
JAKIR:  I LOVE YOU ANIKA
JAKIR:  I LOVE YOU ANIKA
JAKIR:  I LOVE YOU ANIKA

Friday, December 10, 2010

Using Escape Sequence

#include <stdio.h>
int main(void)
{
    printf("\tANIKA\n");
    printf("\?\?JAKIR\?\?\n");
    printf("\"ANIKA+JAKIR\"");
    system("pause");
    return 0;
}



This is the output:

ANIKA
??JAKIR??
"ANIKA+JAKIR"