Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

what is rthe error

+1 vote
asked May 7, 2021 by Piyush Mulik (130 points)
//NAME : PIYUSH NAGNATH MULIK
//ROLL NO. : RBT20CE028
//Write a program in C to define a structure for Customer bank account that holds Information like Account Number, Name of account holder, balance, Internet banking facility availed(Yes or No), Pin code ( 422001 to 422013) ,Account type(saving, recurring, deposit).  

#include <stdio.h>

struct bank
{
    int account_no;
    char acc_name[10];
    float balance;
    int pin;
    char acc_type[10];
}s1[3];
    int i;
   {
    printf(" enter bank Customer record ");
    for(i=0; i<3; i++)
    {
        scanf("%d %s %f %s  %s", &s1[i] .acc_ no, &s1[i] . acc_name, &s1[i]. balence,
        &s1. pin, &s1 .acc_type);
    }
    
    for(i=0;i<3;i++);
      {
          if(s1[i].balence>1000000)
    
        printf("%s is golden customer", s1[i]. acc_name);
    }
    else if(s1[i]. balence>500000 && s1[i]. bnalence<100000)
    
        printf("%s is silver customer", s1[i]. acc_name);
    }
    {
    else if(s1[i]. balence<99999)
        printf("%s is general customer", s1[i]. acc_name)
}

1 Answer

+1 vote
answered May 15, 2021 by xDELLx (10,500 points)

I hope you were joking when you asked what the error was  !!

Your code had bunch of errors ,which could be corrected if you write the code in small chunks.

From what i can tell, you just opened you fav notepad app  & wrote what you think would have worked .anyways i have corrected the code which compiles but not sure what logic it uses .

Cheers !!


#include <stdio.h>

struct bank
{
        int acc_no;
        char acc_name[10];
        float balence;
        int pin;
        char acc_type[10];
}s1[3];

int main(){
        int i;
        printf(" enter bank Customer record ");
        for(i=0; i<3; i++)
        {   
                scanf("%d %s %f %d  %s", &(s1[i].acc_no), s1[i].acc_name, &(s1[i].balence), &(s1[i].pin), s1[i].acc_type );
        }   

        for(i=0;i<3;i++);
        {   
                if(s1[i].balence>1000000)

                        printf("%s is golden customer", s1[i].acc_name);

                else if(s1[i].balence>500000 && s1[i].balence<100000){

                        printf("%s is silver customer", s1[i].acc_name);
                }
                else if(s1[i].balence<99999)
                                printf("%s is general customer", s1[i].acc_name);
                    
        }
        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.
...