Monday 12 July 2010

Program to generate the tables using loops

//program to generate the tables
#include<stdio.h>
void main()
{
 int i;
 int n=2;
 int prod=1;
 for(i=1;i<=10;i++)
 {
  prod=n*i;
  printf("%d*%d=%d\n",n,i,prod);
 }
 getch();
}
/*
2*1=2
2*2=4
2*3=6
*/
You may like the following posts:
Loops
Example program for comma operator in for loop
 Do..while loop
   Simple example program on do while loop
Find the value of sin(x) using the series up to the given accuracy

Write a program to display the diamond shape

No comments:

Post a Comment