Brijmohan lal Sahu - Facebook
Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Thursday, December 4, 2014

Program to print table of any input number along with sum of all values using while loop in C.




codeboxc


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: