Code Box
--------------------------------------------
/*Program to print table of any input number along with sum of all values */
#include<stdio.h>
#include<conio.h>
void main()
{
int num,i,sum,mul;
sum=0;
i=1;
clrscr();
printf("\nEnter any number:");
scanf("%d",&num);
clrscr(); //for clear screen
printf("\n-------------------------------");
printf("\nNumber entered is: %d",num);
printf("\n-------------------------------");
printf("\nTable of %d is",num);
printf("\n---------------------------------------\n");
while(i<=10)
{
mul=num*i;
printf("| %d ",mul);
sum=sum+mul;
i++;
}
printf("\n--------------------------------------");
printf("\nSum of table is : %d",sum);
getch();
}
No comments:
Post a Comment