N O T I C E

Project on Computer topics, Programs for practicals for BCA Students, and Mobile Android app requirements. Please pay less and get more immediate delivery for school and higher level. Thank You. Contact me - at +91-8800304018(w)
Showing posts with label C for Beginner's. Show all posts
Showing posts with label C for Beginner's. Show all posts

Wednesday, March 18, 2026

Electricity Bill Calculation System in C Language (100 Units Free Scheme)

 


ElectricitybillCalculation System In C Language (100 Units Free Scheme) Download Free

       Help Us by Donating



Here is a complete C Language Project on Electricity Bill Management System with documentation. It is suitable for BCA / Computer Practical File and includes Introduction, Algorithm, Program, Output, and Viva Questions.


ELECTRICITY BILL MANAGEMENT SYSTEM (C LANGUAGE)

1. Title

Electricity Bill Calculation System in C Language (100 Units Free Scheme)


2. Introduction

Electricity billing systems are used to calculate the electricity charges consumed by a customer.
This project is developed in C programming language to calculate the electricity bill based on units consumed.

In this system, the first 100 units are free as per government scheme, and charges are applied only after 100 units.

This program takes customer details and electricity units consumed as input and calculates the final bill amount automatically.


3. Objective

The objectives of this project are:

  • To calculate electricity bills using C programming.
  • To apply government scheme (first 100 units free).
  • To practice structures, conditional statements and arithmetic operations in C.
  • To generate a formatted electricity bill.

4. Features of the System

  • Customer Name Input
  • Consumer Number
  • Units Consumed
  • First 100 Units Free
  • Automatic Bill Calculation
  • Display Final Bill

5. Assumed Electricity Tariff

Units Range

Rate

0 – 100

Free

101 – 200

₹5 per unit

201 – 300

₹7 per unit

Above 300

₹10 per unit


Electricity Bill Calculation System in C Language (100 Units Free Scheme)

6. Algorithm

1.    Start the program.

2.    Input customer name.

3.    Input consumer number.

4.    Input units consumed.

5.    Check if units ≤ 100

o    Bill = 0

6.    If units between 101 and 200

o    Bill = (units − 100) × 5

7.    If units between 201 and 300

o    Bill = (100 × 5) + (units − 200) × 7

8.    If units above 300

o    Bill = (100 × 5) + (100 × 7) + (units − 300) × 10

9.    Display customer details and bill amount.

10.                       Stop the program.


7. Flowchart (Text Representation)

Start

   |

Enter Customer Details

   |

Enter Units Consumed

   |

Units <= 100 ?

   |Yes

Bill = 0

   |

   No

Units <= 200 ?

   |Yes

Bill = (Units-100)*5

   |

   No

Units <= 300 ?

   |Yes

Bill = (100*5) + (Units-200)*7

   |

   No

Bill = (100*5)+(100*7)+(Units-300)*10

   |

Display Bill

   |

End


8. C Program

#include<stdio.h>

 

int main()

{

    char name[50];

    int consumer_no;

    float units, bill=0;

 

    printf("\n===== Electricity Bill System =====\n");

 

    printf("Enter Customer Name: ");

    scanf("%s", name);

 

    printf("Enter Consumer Number: ");

    scanf("%d", &consumer_no);

 

    printf("Enter Units Consumed: ");

    scanf("%f", &units);

 

    if(units <= 100)

    {

        bill = 0;

    }

    else if(units <= 200)

    {

        bill = (units - 100) * 5;

    }

    else if(units <= 300)

    {

        bill = (100 * 5) + (units - 200) * 7;

    }

    else

    {

        bill = (100 * 5) + (100 * 7) + (units - 300) * 10;

    }

 

    printf("\n\n----- Electricity Bill -----\n");

    printf("Customer Name     : %s\n", name);

    printf("Consumer Number   : %d\n", consumer_no);

    printf("Units Consumed    : %.2f\n", units);

    printf("Total Bill Amount : Rs %.2f\n", bill);

 

    printf("\nFirst 100 Units are Free (Govt Scheme)\n");

 

    return 0;

}



Electricity Bill Calculation System in C Language (100 Units Free Scheme)


9. Sample Output

===== Electricity Bill System =====

 

Enter Customer Name: Asif

Enter Consumer Number: 1025

Enter Units Consumed: 250

 

 

----- Electricity Bill -----

Customer Name     : Asif

Consumer Number   : 1025

Units Consumed    : 250

Total Bill Amount : Rs 850.00

 

First 100 Units are Free (Govt Scheme)


10. Advantages

  • Simple and easy to use
  • Reduces manual billing errors
  • Implements government subsidy logic
  • Useful for learning C programming

11. Limitations

  • Works for a single customer at a time
  • No database storage
  • No file handling

12. Future Improvements

  • Add file handling to store customer records
  • Add multiple customer billing
  • Create menu-driven program
  • Convert into GUI application

13. Viva Questions

1. What is C language?
C is a general-purpose programming language used for system and application programming.

2. What is a variable?
A variable is a named memory location used to store data.

3. What is an if statement?
It is a conditional statement used to execute code based on conditions.

4. What is printf()?
It is a function used to display output on the screen.

5. What is scanf()?
It is used to take input from the user.

6. What are data types in C?
Examples: int, float, char, double.


14. Conclusion

The Electricity Bill Management System developed in C successfully calculates the electricity bill based on the number of units consumed while applying the 100 units free government scheme. This project demonstrates the use of conditional statements, input/output functions, and arithmetic calculations in C.


 

 Electricity Bill Calculation System in C Language (100 Units Free Scheme)

 

If you want, I can also give you:

  • Full BCA Practical File Format (Cover Page + Certificate + Acknowledgement + Index)
  • Improved Version with File Handling (Store Customer Records)
  • Menu Driven Electricity Bill System (More Professional Project)
  • 30 Viva Questions for Exam

Just tell me 👍.

 

Thank you

 

Thursday, March 12, 2026

Practical for Beginners with Solutions

 

Practical for Beginners with Solutions

         Help Us by Donating


Practical for Beginners  Download for practical



Introduction to C Practical (100 Solved Questions)

This practical file contains 100 important programs written in the C programming language. The main purpose of this practical work is to help BCA students understand the basic and advanced concepts of C programming through practice. C is one of the most important programming languages and it forms the foundation for learning many other languages.

In this practical file, different types of programs are included which cover topics such as basic numerical programs, control statements, strings, arrays, and file handling. Each program is explained with a simple algorithm, C program code, and sample output, so that students can easily understand the logic and working of the program.

The programs are arranged topic-wise, starting from simple programs and gradually moving toward more complex problems. This makes it easier for students to learn step by step and improve their programming skills.

This practical file is useful for students because it helps them to:

  • Understand the basic structure of C programs
  • Improve their logical thinking and programming skills
  • Practice important programs frequently asked in exams
  • Prepare for practical exams and viva questions
  • Gain confidence in writing programs independently

Topic-wise Summary of C Practical Questions

1. Basic Programs and Numerical Problems

The first section includes basic programs and numerical problems. These programs help students learn the fundamental concepts of C programming such as variables, operators, and input/output statements.

Some examples of programs in this section include:

  • Swapping two numbers
  • Finding the factorial of a number
  • Checking whether a number is prime or not
  • Calculating simple interest
  • Finding the largest among three numbers
  • Finding the sum of digits of a number

These programs help beginners understand how a program works and how to apply simple logic in programming.


2. Control Statements

This section focuses on decision-making and looping statements, which are essential in programming.

The topics covered include:

  • if and if–else statements
  • nested if statements
  • switch case statements
  • for loop
  • while loop
  • do–while loop

Some common programs in this section are:

  • Checking whether a number is even or odd
  • Printing multiplication tables
  • Generating number patterns
  • Displaying Fibonacci series
  • Reversing a number

These programs help students understand how programs can make decisions and repeat tasks using loops.


3. String Programs

In this section, students learn how to work with strings in C programming. Strings are used to store and manipulate text data.

Programs included in this section are:

  • Finding the length of a string
  • Concatenating two strings
  • Comparing two strings
  • Reversing a string
  • Checking whether a string is a palindrome

Students also become familiar with string functions available in the C library, such as strlen(), strcpy(), and strcmp().


4. Single Dimensional Array Programs

This section explains the use of one-dimensional arrays, which allow programmers to store multiple values in a single variable.

Some programs included in this section are:

  • Finding the sum and average of array elements
  • Searching an element in an array
  • Finding the largest and smallest element in an array
  • Sorting elements of an array
  • Counting even and odd numbers in an array

These programs help students understand how arrays can be used to manage and process multiple data values efficiently.


5. Two Dimensional Array Programs

This section introduces two-dimensional arrays, which are mainly used for matrix operations.

Programs included in this section are:

  • Matrix addition
  • Matrix subtraction
  • Matrix multiplication
  • Transpose of a matrix
  • Finding the sum of rows and columns in a matrix

Through these programs, students learn how to work with data arranged in rows and columns.


6. File Handling Programs

The last section deals with file handling in C. File handling allows programs to store information permanently in files so that it can be used later.

Programs included in this section are:

  • Creating a file
  • Writing data into a file
  • Reading data from a file
  • Appending data to a file
  • Counting characters in a file

This section helps students understand how programs can store and retrieve data using files.


Conclusion

This practical file of 100 solved C programs is very helpful for BCA students who want to improve their understanding of C programming. By practicing these programs regularly, students can develop better programming skills and logical thinking.

It also helps students perform well in practical examinations and viva, and it builds a strong base for learning other programming languages in future studies.


Saturday, August 31, 2024

Top Programming on Structure, Enumeration (enum), and their output in C Language by Md Farrukh Asif

 Top Programming on Structure, Enumeration (enum), and their output in C Language.

by Md Farrukh Asif Run

C Structures (structs)

Structures:

Structures is very important data member. It (also called structs) is a way to group several related variables into one place. Each variable in the structure is known as a member of the structure.

Unlike an array, a structure can contain many different data types (int, float, char, etc.).

 

struct MyStructure {             // Structure declaration
  int myNum;                          // Member (int variable)
  char myLetter;                     // Member (char variable)
};                                 
            // End the structure with a semicolon

 

Access Structure Members

To access members of a structure, use the dot syntax (.):

 

 // Create a structure called studStructure
struct myStructure {
  int Num;
  char Letter;
};
int main() {
  // Create a structure variable of myStructure called s1
  struct studStructure s1;

  // Assign values to members of s1
  s1.Num = 13;
  s1.Letter = 'B';

  // Print values
  printf("My number: %d\n", s1.Num);
  printf("My letter: %c\n", s1.Letter);

  return 0;
}

 

==============

Output:

 

My number: 13
My letter: B

===============

 

Simpler Syntax

You can also assign values to members of a structure variable at declaration time, in a single line.

Just insert the values in a comma-separated list inside curly braces {}. Note that you don't have to use the strcpy() function for string values with this technique:

 

// Create a structure
struct studentStructure {
  int  Num;
  char  Letter;
  char  String[30];
};

int main() {
  // Create a structure variable and assign values to it
  struct myStructure s1 = {13, 'B', "Example of string data member"};

  // Print values
  printf("%d %c %s", s1.Num, s1.Letter, s1.String);

  return 0;
}

 

================

Output:

13 B Exxample of string ddata member

=================================

 

Copy Structures:

You can also assign one structure to another.

In the following example, the values of s1 are copied to s2:

Example

struct myStructure s1 = {13, 'B', "Example of string data member"};
struct myStructure s2;

s2 = s1;

 

Here, s1 data structure will be copied into s2.

 

Modify Values

If you want to change/modify a value, you can use the dot syntax (.).

And to modify a string value, the strcpy() function is useful again:

Example

struct myStructure {
  int myNum;
  char myLetter;
  char myString[30];
};

int main() {
  // Create a structure variable and assign values to it
  struct myStructure s1 = {13, 'B', "Some text"};

  
// Modify values
  s1.myNum = 30;
  s1.myLetter = 'C';
  strcpy(s1.myString, "Write something else");

  // Print values
  printf("%d %c %s", s1.myNum, s1.myLetter, s1.myString);

  return 0;
}

==============

 

Real-Life Example

Use a structure to store different information about Cars:

Example

struct Car {
  char brand[50];
  char model[50];
  int year;
};

int main() {
  struct Car car1 = {"BMW", "X5", 1999};
  struct Car car2 = {"Ford", "Mustang", 1969};
  struct Car car3 = {"Toyota", "Corolla", 2011};
// Printing the Object or variables
  printf("%s %s %d\n", car1.brand, car1.model, car1.year);
  printf("%s %s %d\n", car2.brand, car2.model, car2.year);
  printf("%s %s %d\n", car3.brand, car3.model, car3.year);
  return 0;
}

===============

C Enums

An enum is a special type that represents a group of constants or numeric only (unchangeable values).

To create an enum, use the enum keyword, followed by the name of the enum, and separate the enum items with a comma:

enum Level {
  LOW,
  MEDIUM,
  HIGH
};

Note that the last item does not need a comma.

It is not required to use uppercase, but often considered as good practice.

Enum is short for "enumerations", which means "specifically listed".

To access the enum, you must create a variable of it.

Inside the main() method, specify the enum keyword, followed by the name of the enum (Level) and then the name of the enum variable (myVar in this example):

enum Level myVar;

Now that you have created an enum variable (myVar), you can assign a value to it.

The assigned value must be one of the items inside the enum (LOWMEDIUM or HIGH):

enum Level myVar = MEDIUM;

By default, the first item (LOW) has the value 0, the second (MEDIUM) has the value 1, etc.

If you now try to print myVar, it will output 1, which represents MEDIUM:

#include <stdio.h>

 

enum Level {

  LOW,

  MEDIUM,

  HIGH

};

 

int main() {

  // Create an enum variable and assign a value to it

  enum Level myVar1 = MEDIUM;

  enum Level myVar2 = LOW;

  enum Level myVar3 = HIGH;

 

  // Print the enum variable

  printf("%d", myVar1);

   printf("\n%d", myVar2);

    printf("\n%d", myVar3);

 

  return 0;

} ===============

Output:

1

0

2

==========

Enum in a Switch Statement

Enums are often used in switch statements to check for corresponding values:

enum Level {
  LOW = 1,
  MEDIUM,
  HIGH
};

int main() {
  enum Level myVar = MEDIUM;
  switch (myVar) {
    case 1:
      printf("Low Level");
      break;
    case 2:
      printf("Medium level");
      break;
    case 3:
      printf("High level");
      break;
  }
  return 0;
}

=================

C Language:

C for the beginner 's by Md Farrukh Asif

Operators in C by Md. Farrukh Asif

C's Control Flow by Md. Farrukh Asif

String handling in C by Md Farrukh Asif

The Function of C Language by Md. Farrukh Asif

File Handling With Various Statements/Syntaxes In Programming And Their Output In C Language.

C For Beginner's Programming With Output. Course Code – 106 [‘C’]) TMBU,BGP

Bca Solved Examination Questions With Answers Course Code – 106 [‘C’]) Tmbu,Bgp

Top Programming on Structure, Enumeration (enum), and their output in C Language by Md Farrukh Asif

Here’s a FAQ on structures and enumerations (enum) in C:

Structures in C:

Q1: What is a structure in C?
A structure is a user-defined data type in C that allows grouping variables of different data types together under a single name. This is particularly useful for representing more complex data entities.

Q2: How do you define a structure in C?

struct StructureName {
    dataType1 member1;
    dataType2 member2;
    ...
};

Example:

struct Student {
    char name[50];
    int rollNumber;
    float marks;
};

 

 

Q3: How do you declare and initialize a structure variable?

struct Student student1 = {"John Doe", 101, 85.5};

Q4: How do you access members of a structure?
You can access the members of a structure using the dot (
.) operator.

printf("Name: %s\n", student1.name);
printf("Roll Number: %d\n", student1.rollNumber);
printf("Marks: %.2f\n", student1.marks);

Q5: Can you have a pointer to a structure?
Yes, you can have a pointer to a structure and access its members using the arrow (
->) operator.

struct Student *ptr = &student1;
printf("Name: %s\n", ptr->name);

Q6: Can structures contain other structures?
Yes, structures can contain other structures, allowing for the creation of complex data types.

struct Address {
    char city[50];
    int pin;
};
 
struct Student {
    char name[50];
    struct Address address;
};

Q7: What is the size of a structure?
The size of a structure is the sum of the sizes of its members, but it may also include padding bytes to ensure proper alignment in memory.

Q8: Can structures be passed to functions?
Yes, structures can be passed to functions by value or by reference (using pointers).

Enumerations (enum) in C:

Q1: What is an enumeration in C?
An enumeration (enum) is a user-defined data type that consists of integral constants. It is used to assign names to the integral constants which make the code more readable.

Q2: How do you define an enumeration in C?

enum EnumName {
    constant1,
    constant2,
    ...
};

Example:

enum WeekDay {
    Sunday,
    Monday,
    Tuesday,
    Wednesday,
    Thursday,
    Friday,
    Saturday
};

Q3: What are the default values of enum constants?
By default, the first constant is assigned the value 0, and each subsequent constant is assigned the value incremented by 1.

enum WeekDay {
    Sunday,    // 0
    Monday,    // 1
    Tuesday,   // 2
    ...
};

Q4: Can you assign specific values to enum constants?
Yes, you can assign specific values to enum constants.

enum WeekDay {
    Sunday = 1,
    Monday = 2,
    Tuesday = 5,
    Wednesday = 10
};

Q5: How do you declare and use an enum variable?

enum WeekDay today;
today = Wednesday;
printf("Day: %d\n", today);  // Output will be 10

Q6: What is the size of an enum in C?
The size of an enum in C is the same as the size of an
int, since enums are implemented as integers in C.

Q7: Can enums be used in switch statements?
Yes, enums are often used in switch statements to handle different cases.

switch (today) {
    case Sunday:
        printf("It's Sunday\n");
        break;
    case Monday:
        printf("It's Monday\n");
        break;
    ...
}

Q8: Can two enum constants have the same value?
Yes, two enum constants can have the same value, but it is generally discouraged as it can lead to confusion.

 *** See You Again ***

************************

Share and Subscribe with Like

************************