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

Trending Topics

Online now

Members online
348
Guests online
3,778
Total visitors
4,126

Forum statistics

Threads
2,294,771
Posts
29,093,134
Members
1,207,526
Latest member
cindys-pinili
Back
Top