Create a C program using goto statement in C language.

Status
Not open for further replies.

If Else

Established
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.

About this Thread

  • 1
    Replies
  • 576
    Views
  • 2
    Participants
Last reply from:
zhero25

Online now

Members online
1,037
Guests online
1,558
Total visitors
2,595

Forum statistics

Threads
2,277,093
Posts
28,974,329
Members
1,229,728
Latest member
loglogss
Back
Top