Friday, March 28, 2014

Make a program which calculates and prints the number,its square & its cube using for loop and print in the form of table using tabs

#include<stdio.h>
#include<stdlib.h>
void line()
{
int i,j;
printf("\n");
for(i=1;i<=42;i++)
printf("=");
}
void header()
{
printf("\n");
printf("Built and Designed by Arslan Malik\n\n www.CworldbyAS.blogspot.com");
printf("\n");
}
int main()
{
line();
header();
line();

   int a;
   printf("\nNumber\t:\tSquare\t:\tCube\t\n");
   for(a=0;a<=10;a++)
   {

       printf("%d\t:\t%d\t:\t%d\t\n",a,a*a,a*a*a);
   }


return 0;
}

No comments:

Post a Comment