how to list the character output if the input is integer number

+1 vote
asked Oct 22, 2019 by Syereen Elsa (130 points)

#include <stdio.h>
int main()
{
    int state,N; //declaration
    int i,j;          
    printf("\nData you have: ");
    scanf("%d",&N);
    int list[3];
   
      for(int i=0;i<3;i++)
       // scanf("%d", &list[i]);
    {   
        for(j=1;j<=N;j++){
        printf("\nEnter the state:");
        scanf("\n%d", &state);
            {
                if (state>=1 && state<=5)
            {
                    printf("A");
            }
                else if (state>=6 && state<=10)
            {
                    printf("B");
             }
                else if (state>=11 && state<=15)
            {
                    printf("C");
            }
                else
                    {
                        printf("not valid");
                    }}
           }
 
{
    printf("\nelements are: ",state);
}
           return 0;} }

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Need help for this. I try using array but unable to call back the ABC output for the element. since the input is integer

1 Answer

0 votes
answered Oct 27, 2019 by Anonymous A (140 points)
int main()
{
   int a;

    printf("enter   an interger input");
    scanf("%d",&  a);
    char b = a;
    printf("%c",b);
    return 0;
    
}
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...