C program to read customer number and power consumed and print the amount to be paid 

C program to read the customer number and power consumed and print amount to be paid 

We can find the sum of elements stored in an array using pointers.   For example:  if the number of elements to be added are 4 and if we give the elements one by one as 4 5 6 3, then the sum of elements stored in the array will be 18. The below given C program will find the sum of all elements in array using pointers.  Kindly check out the program to find the sum of all elements in array using pointers

Program to read customer number, power consumed and print the amount to be paid 


    #include<stdio.h>
    int main() {
                   unsigned long int CustomerNo;
                   int PowerUsed;
                   float amount;
                   printf("Give Your Customer number : ");
                   scanf("%ld", &CustomerNo);
                   printf("\n Enter the power consumed : ");
                   scanf("%d", &PowerUsed);
                   if (PowerUsed >= 0 && PowerUsed <= 150)
                   amount = PowerUsed * 0.50;
                   else
                   if (PowerUsed > 150 && PowerUsed < 350)
                   amount = 75 + ((PowerUsed - 150) * 0.80);
                   else
                   if (PowerUsed > 350 && PowerUsed <= 800)
                   amount = 235 + ((PowerUsed - 350) * 1.50);
                   printf("\n\n The customer no. %ld has to pay amount in INR : %6.2f", CustomerNo, amount);
    return(0); 
    }

  


Sample Output:

                        Give Your Customer number : 3452
                        Enter the power consumed : 150

                        The customer no. 3452 has to pay amount in INR : 75.00

Related Popular Posts:

*  Write a c program to check whether a given number is prime number or not?

 

*  Write a C program to find the prime numbers between 1 and 100

 

*  Write a C program to display the prime numbers between a range ?

 

*  Write a C program to find the prime numbers between a range using while loop?

 

*  Write a C program to find the sum of prime numbers between a range 

Other Related C Programs :


* C Program to find whether the given number is Odd or Even

* C Program to find the Sum of Odd Digits

* C Program to find the Sum of Even Digits

* C Program to find the Sum of Even and Odd Digits,

* C Program to Display Odd digits

* C Program to Display even digits

* C Program to Display Odd Numbers,

* C Program to Display Even Numbers,

* C Program to Check whether the given number is Armstrong number

* C Program to display the Armstrong numbers in Range

* C Program to display the Armstrong numbers between 1 and 1000

* C Program to check perfect number, perfect numbers in range

* C Program to Check Prime number, Prime numbers between 1 and 100

* C Program to display the Prime numbers in a Range

* C Program to display the Sum of Prime numbers

* C Program to Check Strong number

* C Program to display the Strong number in Range

* C Program to Check whether the given number is polindrome number or not

* C Program to Check polindrome number using for loop

* C Program to Check polindrome number using Recursion

* C Program to  check whether the given string is polindrome or not

* C Program to find the Roots of Quadratic equation

* C Program to display Fibonacci Series

* C Program to display the Fibonacci Series using an array

* C Program to display the Fibonacci Series using while loop

* C Program to find the Sum of Fibonacci Series, Factorial of Number

* C Program to find the Factorial without using Recursion

* C Program to find the Factorial using Pointers

* C Program to find the Factorial using Function

Bookmark and Share