Answer to Question #213314 in C for Prasanna

Question #213314

Develop a C program for File Operations that stores n number of the Alphabets from A to Z in a file and display it.


Runtime Input :

11

80


Output :

P

Q

R

S

T

U

V

W

X

Y

Z


1
Expert's answer
2021-07-05T01:07:03-0400


#define _CRT_SECURE_NO_WARNINGS
#include <stdlib.h>//Standart Library -using FILE for work file function
#include <stdio.h>//Standart input output Library 


int main()
{
	int n;//Count the alphabet form A to Z
	int beginCode;//Begining ACSSI code for example 80-P  or 65 -A [65,97]=[A..Z]
	scanf("%i", &n);//Scanner n 
	scanf("%i", &beginCode);//..
	FILE* fl;//FILE handler
	fl = fopen("alphabet.txt", "w+");//Write to alphabet txt file
	char ch = (char)beginCode;
	for (int i = 0; i < n; i++)
	{
		printf("%c\n", ch);
		fprintf(fl, "%c\n", ch);
		ch++;
	}
	fclose(fl);//Closing file
	return 0;
}
//Test example
/*
Input
11
80
Output
P
Q
R
S
T
U
V
W
X
Y
Z
Test verify
*/

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS