Write a program that prompts the user to input an integer between 0 and 25. If user enters 0 then Display A, if user enters 1 then Display B, if user enter 2 then Display C and so On...
Otherwise Display Invalid Number and Prompt for Character to Start Again/Exit. Don.t use more than 5 if else statements otherwise you will get 0 marks.
Sample Output:
Enter Number = 5
5=F
Do You Want To Continue Press y/n ? y
Enter Number = 0
0=A
Do You Want To Continue Press y/n ? n
#include <stdio.h>
#include <conio.h>
void main()
{
int a=0;
char x;
do
{
printf("Enter numbers from 0 to 25: ");
scanf("%d",&a);
if(a>=0 && a<=25)
{
a=a+65;
a=(char)a;
printf("%c\n\n",a);
}
else
printf("Invalid Number Entered\n");
printf("Do you want to continue Press y/n: \n");
x=getch();
}
while(x=='y');
getch();
}
{[['
']]}

0 comments:
Post a Comment
Click to see the code!
To insert emoticon you must added at least one space before the code.