What's new

Create a C program using goto statement in C language.

Status
Not open for further replies.

Sakurara

Eternal Poster
Established
Joined
Nov 24, 2016
Posts
574
Reaction
104
Points
389
Create a C program using goto statement in C language. Please see the exact output below.
Enter the number whose table you want to print? 10
10 x 1 = 10
10 x 2 = 20
10 x 3 = 30
10 x 4 = 40
10 x 5 = 50
10 x 6 = 60
10 x 7 = 70
10 x 8 = 80
10 x 9 = 90
10 x 10 = 100

Patulong po:)
 
try this... baka ganito un

#include <stdio.h>
int main() {
int n, i;
printf("Enter an integer: ");
scanf("%d", &n);

if (n<=0) {
goto end;
} else {
for (i = 1; i <= 10; ++i) {
printf("%d * %d = %d \n", n, i, n * i);
}
}
end:
return 0;
}
 
Status
Not open for further replies.

Similar threads

Back
Top