Create a C program using goto statement in C language.

Status
Not open for further replies.

If Else

Eternal Poster
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
  • 598
    Views
  • 2
    Participants
Last reply from:
zhero25

Trending Topics

Online now

Members online
559
Guests online
2,790
Total visitors
3,349

Forum statistics

Threads
2,294,730
Posts
29,092,997
Members
1,207,501
Latest member
sjvkuma
Back
Top