Monday 26 September 2011

26-09-2011 4th Division of Two Variables

/*This Program takes two values from user divides 1st by 2nd and then shows the result */
#include<stdio.h>
#include<conio.h>
main()
     
      {
    float val1;
    float val2;
    float div ;
    printf("\n Please enter the first value: ");
    scanf("%f",& val1);
    printf("\n Please enter the second value: ");
    scanf("%f",& val2) ;
    div = val1 / val2 ;
    printf(" \n The dividion of %f by %f is: %f",val1,val2,div) ;
    getche() ;
    return 0 ;
}

26-09-2011 3rd Addition of Two Variables


 /*This Program takes two values from user, adds them and then shows the result */
#include<stdio.h>
#include<conio.h>
main()
      {
      int val1 , val2, sum;
      printf(" \nPlease enter the first value: ");
      scanf("%d",&val1);
      printf(" \nPlease enter the 2nd value: ");
      scanf("%d",&val2);
      sum = val1 + val2;
      printf(" \nThe Sum of %d and %d is: %d", val1,val2,sum);
      getche();
      return 0;
      }

26-09-2011 2nd Print Hello Word (each letter new line)

/*Prints hello world each character in new line */
#include<stdio.h>
#include<conio.h>
int main()     
     
{
      printf("H\n E\n  L\n   L\n    L\n     O\n      W\n       O\n        R\n         L\n          D ");
      getche();
      return 0;
}

26-09-2011 1st Print hello word

/*first c program in lab */
/*Prints hello world */ 
#include<stdio.h>
#include<conio.h>
main()
      {
                 printf("hello word");
                 getche();
      }