Q:

C program to print ASCII values of all uppercase alphabets using goto statement

0

C program to print ASCII values of all uppercase alphabets using goto statement

We have to print ASCII values of all uppercase alphabets along with alphabets using C program.

In this program, we are using a variable named count which will be initialized by 'A' and with the help of label, goto statement and condition; we are printing the ASCII values of all uppercase alphabets.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Program

#include<stdio.h>

int main()
{
	//counter, it can also be declared as 'char'
	int count;
	//initializing counter by 'A'
	count= 'A';
	//definig label
	start:
	printf("%c [%d] ",count,count);
	count++;
	//jumping back to 'stat' if condition is true
	if(count <= 'Z')
		goto start;
	return 0;
}

Output

A [65] B [66] C [67] D [68] E [69] F [70] G [71] H [72] 
I [73] J [74] K [75] L [76] M [77] N [78] O [79] P [80] 
Q [81] R [82] S [83] T [84] U [85] V [86] W [87] X [88] 
Y [89] Z [90] 

This is a way, by which we can print ASCII values of all uppercase characters (alphabets), please write through comment, if you have any doubt?

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C program to print ASCII values of all lowercase a... >>
<< C program to print 1, 11, 31, 61, ... 10 times usi...