Thursday 27 October 2011

Clik Links Below to Access


Lab Tasks


Lab Tasks 26-09-2011 (1st Lab)

Lab Tasks 03-09-2011 (2nd Lab)

Lab Tasks 10-09-2011 (3rd Lab)

Lab Tasks 17-09-2011 (4th Lab)



Assignments
 
17-10-2011 Printing Stars

This program takes a number from user and shows its table

/*This program takes a number from user and shows its table*/
#include<stdio.h>
#include<conio.h>
main()
{
     

       char exit = ' ';
       do
       {
             int num = 0 , counter=1, ans, limit = 0;  
     
/*taking digit as input which table has to be shown*/
              while (num <= 0  || num >= 99999999 )
              {
                    printf("Please enter a digit to see its table: ");
                    scanf("%d",&num);
                    if (num <= 0 || num > 99999999 )
                    {
                    printf("\nWarning! Enter positive integer value only between 1 and 99999999.\n\n");
                    } 
              }
             
/*taking limit as input upto which digit's table has to be shown*/
              while (limit <= 0 || limit > 100)
              {
              printf("\nNow enter the limit upto which you want the table: ");
              scanf("%d",&limit);
                    if (limit <= 0 || limit > 100)
                    {
                    printf("\nWarning! The limit is upto 100 and should be greater than zero.\n");
                    }             
              }
              
 /*Calculations and printing results*/
             
              while ( counter <= limit )
              {
                    ans = counter * num;
                    printf("%d x %d = %d\n",num,counter,ans);
                    counter = counter +1;
              }
             
         
              exit = ' ';
              
/*To continue or exit*/
             while(exit !='e' && exit != 'c' && exit !='E' && exit != 'C')
             {
                    printf("\n\nEnter 'e' to exit or 'c' to continue using program: ");
                    scanf("%c",&exit);
                    exit = getche();
                    printf("\n\n");
             }
           
      }
      while (exit != 'e' && exit != 'E');   
      getche();
      return 0;
}