Friday, 26 June 2015



wap To Print Value One less than & One More Than The Given Value & Print Their Sum .

Code –



#include<stdio.h>

#include<conio.h>

void main ()

{

int a,b,c,sum;

clrscr();

printf("Enter The Value \t");

scanf("%d",&a);

b= a-1;

c= a+1;

sum=a+b+c;

printf("\nThe Value One less Than The Given Value %d",b);

printf("\nThe Value One Greater Than The Given Value %d",c);

printf("\nThe Value Of Their Sum Is %d",sum);

getch();

}

OUTPUT

Enter The Value 5

The Value One Less Than The Given Value 4

The Value One Greater Than The Given Value 6

The Value Of Their Sum Is 15


-     To print ASCII value of Entered Character
      Code-

      #include<stdio.h>
      #include<conio.h>
       void main()
        {
        char a;
        clrscr(); 
     printf("Enter The Character Whose ASCII value You Want To            Print \t ");
       a = getchar();
       printf("\n The ASCII Value of Entered Character Is %d", a);
       getch();
}
   
      OUTPUT
       Enter The Character Whose ASCII value You Want To
        Print    a

       The ASCII Value of Entered Character Is 97








Monday, 8 June 2015

5.Aim - WAP To Swap Two Numbers Using Third Variable
Code-

#include<stdio.h>
#include<conio.h>
void main()
{
 int a,b,c;
 clrscr();
 printf("Enter The Value Of a and b respectively : ");
 scanf ("%d%d",&a,&b);
 c=a+b;
 b=c-b;
 a=c-b;
 printf("\nThe Values Of a and b After Swapping is %d %d",a,b);
 getch();
}

OUTPUT
Enter The Values Of a and b respectively : 35  93
The Values Of a and b After Swapping is 93 & 35






4.Aim - WAP To Swap Two Numbers Without Using Third Variable
Code –

#include<stdio.h>
#include<conio.h>
void main()
{
 int a,b;
 clrscr();
 printf("Enter The Value Of a and b respectively : ");
 scanf ("%d%d",&a,&b);
 a=a+b;
 b=a-b;
 a=a-b;
 printf("\nThe Values Of a and b After Swapping is %d & %d",a,b);
 getch();
}

OUTPUT
Enter The Values Of a and b respectively : 35  93
The Values Of a and b After Swapping is 93 & 35






3.Aim -WAP To Perform Various Arithmetic operations
Code-
#include<stdio.h>
#include<conio.h>
void main()
{
 int a, b, sum, diff, pro, div;
 clrscr ();
 printf ("Enter The Two Numbers : ");
 scanf ("%d%d", &a, &b);
 sum=a+b;
 diff=a-b;
 pro=a*b;
 div=a/b;
 printf ("Sum=%d\n", sum);
 printf ("Difference=%d\n", diff);
 printf ("Product=%d\n", pro);
 printf ("Quotient=%d\n", div);
 getch ();
}

OUTPUT
Enter The Two Numbers : 19 21
Sum = 40
Difference = -2
Product = 399
Quotient = 0




2.Aim -  WAP To Convert Celsius Into Farenheit
Code-

#include<stdio.h>
#include<conio.h>
void main ()
{
 float cel, faren;
 clrscr ();
 printf ("Enter The Temperature In Degree Celsius: ");
 scanf ("%f", &cel);
 faren=(9*cel/5)+32;
 printf ("The Equivalent Temperature In Farenheit is : %f", faren);
 getch ();
}

OUTPUT
Enter The Temperature In Degree Celsius: -45
The Equivalent Temperature In Fahrenheit is : -113




 1 Programming:

Aim -  Wap to print hello.
Code-
 #include<stdio.h>
#include<conio.h>
void main ()
{
 printf ("Hello");
 getch ();
}

 Output-



Hello