ADVERTISEMENT
ADVERTISEMENT

C program to print table of a given number using goto statement

In this C program, we are going to learn how to print table of a number? Here, we are taking input of an integer number and printing its table.
Submitted by Manju Tomar, on November 07, 2017

Give a number (N) and we have to print its table using C program.

goto is a jumping statement, which transfers the program’s control to specified label, in this program we will print the table of a number that will be taken by the user.

Example:

Input: 10

Output:
10*1=10
10*2=20
10*3=30
10*4=40
10*5=50
10*6=60
10*7=70
10*8=80
10*9=90
10*10=100

Program to print table of N using goto statement in C

#include<stdio.h>

int main()
{
	//declare variable
	int count,t,r;

	//Read value of t
	printf("Enter number: ");
	scanf("%d",&t);

	count=1;

	start:
	if(count<=10)
	{
		//Formula of table
		r=t*count;
		printf("%d*%d=%d\n",t,count,r);
		count++;
		goto start;
	} 

	return 0;
}

Output

Enter number: 10 
10*1=10
10*2=20
10*3=30
10*4=40
10*5=50
10*6=60
10*7=70
10*8=80
10*9=90
10*10=100

This is how we can print table of N using goto statement? If you liked or have any issue with the program, please share your comment.

C Goto Programs »



ADVERTISEMENT




ADVERTISEMENT



Comments and Discussions!

ADVERTISEMENT

ADVERTISEMENT

ADVERTISEMENT

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.