SlideShare a Scribd company logo
1 of 5
C Language Program
Write a C program to input electricity unit charge and calculate the total electricity bill according to
the given condition:
For first 50 units Rs. 0.50/unit
For next 100 units Rs. 0.75/unit
For next 100 units Rs. 1.20/unit
For unit above 250 Rs. 1.50/unit
An additional surcharge of 20% is added to the bill.
How to calculate electricity bill using if else in C programming. Program to find electricity bill using if
else in C. Logic to find net electricity bill in C program.
/**
* C program to calculate total electricitybill
*/
#include <stdio.h>
int main()
{
int unit;
floatamt, total_amt,sur_charge;
/*
* Read unitconsumedfromuser
*/
printf("Entertotal unitsconsumed:");
scanf("%d",&unit);
/*
* Calculate electricitybillaccordingtogivenconditions
*/
if(unit<= 50)
{
amt = unit* 0.50;
}
else if(unit<= 150)
{
amt = 25 + ((unit-50)*0.75);
}
else if(unit<= 250)
{
amt = 100 + ((unit-150)*1.20);
}
else
{
amt = 220 + ((unit-250)*1.50);
}
/*
* Calculate total electricitybill
* afteraddingsurcharge
*/
sur_charge = amt * 0.20;
total_amt = amt + sur_charge;
printf("ElectricityBill =Rs. %.2f",total_amt);
return0;
}
to display the larger one out of the three given
unequal numbers
#include <stdio.h>
intmain()
{
double n1,n2, n3;
printf("Enterthree numbers:");
scanf("%lf %lf %lf",&n1, &n2, &n3);
if( n1>=n2 && n1>=n3 )
printf("%.2f isthe largestnumber.",n1);
if( n2>=n1 && n2>=n3 )
printf("%.2f isthe largestnumber.",n2);
if( n3>=n1 && n3>=n2 )
printf("%.2f isthe largestnumber.",n3);
return0;
}
Write a Program to inputname,classand marksin five Subjectslike English,math,Nepali,account,
Computerscience FindTotal,percentage,division,remarksThe conditionof divisionis.. :Percentage /
Division:per>= 75 / Distinction,per>=60 AND per<75 / Firstper> = 45 AND per<60 / Second,per>=
35 ANDper <45 / Third and Below-35/Fail.
#include <stdio.h>
#include <conio.h>
voidmain()
{
char name [50];
intclas, eng,nep,math,acc, cscience,total;
floatper;
printf ("Enterthe name of student:");
scanf ("% s",& name);
printf ("Enterthe class:");
scanf ("% d",& clas);
printf ("Enterthe marksin English,Nepali,Math,AccountandComputerScience.");
scanf ("% d%d% d%d% d",& eng,& nep,& math,& acc, & cscience);
printf ("t  nName =% s",name);
printf ("t  nClass=% d", clas);
printf ("nEnglish=  t%d", eng);
printf ("nNepali = t% d",nep);
printf ("nMath =  t%d", math);
printf ("nAccount=  t%d", acc);
printf ("nComputerScience = t%d", cscience);
printf ("n ===============================");
total = eng+ nep+ math + acc + cscience;
per= total / 5;
printf ("Total =  t% d",total);
printf ("Percentage =t% f",per);
if (eng>= 35 && nep> = 35 && math> = 35 && acc> = 35 && cscience>= 35)
printf ("nRemarks:PASSED");
else
printf ("nRemarks:FAILED");
if (per>= 75)
printf ("Division:Distnction");
else if (per>= 60 && per<75)
printf ("Division:First");
else if (per>= 45 && per<60)
printf ("Division:Second");
else if (per>= 35 && per<45)
printf ("Division:Third");
else
printf ("Division:Fail");
getch();
}
Program to calculate simple interest
/*
* C program to calculate simple interest
*/
#include <stdio.h>
int main() {
float principle, rate, time, simpleInterest;
/*
* Take Principle, Rate of interest and
* Time as input from user.
*/
printf("Enter Principle Amountn");
scanf("%f", &principle);
printf("Enter Rate of Interestn");
scanf("%f", &rate);
printf("Enter Time of Loann");
scanf("%f", &time);
/*
* Simple Interest = (Principle X Rate X Time)/100;
*/
simpleInterest = (principle * rate * time)/100;
printf("Simple Interest = %.2f", simpleInterest);
return 0;
}
to determine whether a given number is prime number or not
#include <stdio.h>
intmain()
{
int n,i, flag= 0;
printf("Enterapositive integer:");
scanf("%d",&n);
for(i=2;i<=n/2; ++i)
{
//conditionfornonprime number
if(n%i==0)
{
flag=1;
break;
}
}
if (flag==0)
printf("%disaprime number.",n);
else
printf("%disnotaprime number.",n);
return0;
}

More Related Content

What's hot

SOLID & IoC Principles
SOLID & IoC PrinciplesSOLID & IoC Principles
SOLID & IoC PrinciplesPavlo Hodysh
 
Event Handling in java
Event Handling in javaEvent Handling in java
Event Handling in javaGoogle
 
Event handling
Event handlingEvent handling
Event handlingswapnac12
 
R, Scikit-Learn and Apache Spark ML - What difference does it make?
R, Scikit-Learn and Apache Spark ML - What difference does it make?R, Scikit-Learn and Apache Spark ML - What difference does it make?
R, Scikit-Learn and Apache Spark ML - What difference does it make?Villu Ruusmann
 
VTU Design and Analysis of Algorithms(DAA) Lab Manual by Nithin, VVCE, Mysuru...
VTU Design and Analysis of Algorithms(DAA) Lab Manual by Nithin, VVCE, Mysuru...VTU Design and Analysis of Algorithms(DAA) Lab Manual by Nithin, VVCE, Mysuru...
VTU Design and Analysis of Algorithms(DAA) Lab Manual by Nithin, VVCE, Mysuru...Nithin Kumar,VVCE, Mysuru
 
Basic Java Programming
Basic Java ProgrammingBasic Java Programming
Basic Java ProgrammingMath-Circle
 
Java 8 Stream API. A different way to process collections.
Java 8 Stream API. A different way to process collections.Java 8 Stream API. A different way to process collections.
Java 8 Stream API. A different way to process collections.David Gómez García
 
9. Input Output in java
9. Input Output in java9. Input Output in java
9. Input Output in javaNilesh Dalvi
 
Monoids - Part 1 - with examples using Scalaz and Cats
Monoids - Part 1 - with examples using Scalaz and CatsMonoids - Part 1 - with examples using Scalaz and Cats
Monoids - Part 1 - with examples using Scalaz and CatsPhilip Schwarz
 
08 c++ Operator Overloading.ppt
08 c++ Operator Overloading.ppt08 c++ Operator Overloading.ppt
08 c++ Operator Overloading.pptTareq Hasan
 
Procedure and Functions in pl/sql
Procedure and Functions in pl/sqlProcedure and Functions in pl/sql
Procedure and Functions in pl/sqlÑirmal Tatiwal
 
Java database connectivity with MYSQL
Java database connectivity with MYSQLJava database connectivity with MYSQL
Java database connectivity with MYSQLAdil Mehmoood
 

What's hot (20)

SOLID & IoC Principles
SOLID & IoC PrinciplesSOLID & IoC Principles
SOLID & IoC Principles
 
Data struture lab
Data struture labData struture lab
Data struture lab
 
Event Handling in java
Event Handling in javaEvent Handling in java
Event Handling in java
 
Event handling
Event handlingEvent handling
Event handling
 
R, Scikit-Learn and Apache Spark ML - What difference does it make?
R, Scikit-Learn and Apache Spark ML - What difference does it make?R, Scikit-Learn and Apache Spark ML - What difference does it make?
R, Scikit-Learn and Apache Spark ML - What difference does it make?
 
VTU Design and Analysis of Algorithms(DAA) Lab Manual by Nithin, VVCE, Mysuru...
VTU Design and Analysis of Algorithms(DAA) Lab Manual by Nithin, VVCE, Mysuru...VTU Design and Analysis of Algorithms(DAA) Lab Manual by Nithin, VVCE, Mysuru...
VTU Design and Analysis of Algorithms(DAA) Lab Manual by Nithin, VVCE, Mysuru...
 
Basic Java Programming
Basic Java ProgrammingBasic Java Programming
Basic Java Programming
 
Pointers in C Programming
Pointers in C ProgrammingPointers in C Programming
Pointers in C Programming
 
Java 8 Stream API. A different way to process collections.
Java 8 Stream API. A different way to process collections.Java 8 Stream API. A different way to process collections.
Java 8 Stream API. A different way to process collections.
 
jQuery
jQueryjQuery
jQuery
 
9. Input Output in java
9. Input Output in java9. Input Output in java
9. Input Output in java
 
Monoids - Part 1 - with examples using Scalaz and Cats
Monoids - Part 1 - with examples using Scalaz and CatsMonoids - Part 1 - with examples using Scalaz and Cats
Monoids - Part 1 - with examples using Scalaz and Cats
 
History of java'
History of java'History of java'
History of java'
 
08 c++ Operator Overloading.ppt
08 c++ Operator Overloading.ppt08 c++ Operator Overloading.ppt
08 c++ Operator Overloading.ppt
 
Procedure and Functions in pl/sql
Procedure and Functions in pl/sqlProcedure and Functions in pl/sql
Procedure and Functions in pl/sql
 
Ch 7 data binding
Ch 7 data bindingCh 7 data binding
Ch 7 data binding
 
Java database connectivity with MYSQL
Java database connectivity with MYSQLJava database connectivity with MYSQL
Java database connectivity with MYSQL
 
Java tutorial PPT
Java tutorial PPTJava tutorial PPT
Java tutorial PPT
 
Java operators
Java operatorsJava operators
Java operators
 
Thread priorities
Thread prioritiesThread priorities
Thread priorities
 

Similar to C language program

Core programming in c
Core programming in cCore programming in c
Core programming in cRahul Pandit
 
Introduction to programming c and data-structures
Introduction to programming c and data-structures Introduction to programming c and data-structures
Introduction to programming c and data-structures Pradipta Mishra
 
Introduction to programming c and data structures
Introduction to programming c and data structuresIntroduction to programming c and data structures
Introduction to programming c and data structuresPradipta Mishra
 
Compiler Design Lab File
Compiler Design Lab FileCompiler Design Lab File
Compiler Design Lab FileKandarp Tiwari
 
Dti2143 lab sheet 8
Dti2143 lab sheet 8Dti2143 lab sheet 8
Dti2143 lab sheet 8alish sha
 
Dam31303 dti2143 lab sheet 7
Dam31303 dti2143 lab sheet 7Dam31303 dti2143 lab sheet 7
Dam31303 dti2143 lab sheet 7alish sha
 
LAB_MANUAL_cpl_21scheme-2.pdf
LAB_MANUAL_cpl_21scheme-2.pdfLAB_MANUAL_cpl_21scheme-2.pdf
LAB_MANUAL_cpl_21scheme-2.pdfRavinReddy3
 
Cs291 assignment solution
Cs291 assignment solutionCs291 assignment solution
Cs291 assignment solutionKuntal Bhowmick
 
Data Structure using C
Data Structure using CData Structure using C
Data Structure using CBilal Mirza
 
You are to write a program that computes customers bill for hisher.docx
 You are to write a program that computes customers bill for hisher.docx You are to write a program that computes customers bill for hisher.docx
You are to write a program that computes customers bill for hisher.docxajoy21
 
C- Programming Assignment 4 solution
C- Programming Assignment 4 solutionC- Programming Assignment 4 solution
C- Programming Assignment 4 solutionAnimesh Chaturvedi
 
'C' language notes (a.p)
'C' language notes (a.p)'C' language notes (a.p)
'C' language notes (a.p)Ashishchinu
 
All important c programby makhan kumbhkar
All important c programby makhan kumbhkarAll important c programby makhan kumbhkar
All important c programby makhan kumbhkarsandeep kumbhkar
 

Similar to C language program (20)

Core programming in c
Core programming in cCore programming in c
Core programming in c
 
Introduction to programming c and data-structures
Introduction to programming c and data-structures Introduction to programming c and data-structures
Introduction to programming c and data-structures
 
C programs
C programsC programs
C programs
 
Introduction to programming c and data structures
Introduction to programming c and data structuresIntroduction to programming c and data structures
Introduction to programming c and data structures
 
C file
C fileC file
C file
 
Compiler Design Lab File
Compiler Design Lab FileCompiler Design Lab File
Compiler Design Lab File
 
Dti2143 lab sheet 8
Dti2143 lab sheet 8Dti2143 lab sheet 8
Dti2143 lab sheet 8
 
Presentation1
Presentation1Presentation1
Presentation1
 
Najmul
Najmul  Najmul
Najmul
 
C-programs
C-programsC-programs
C-programs
 
C Programming Example
C Programming Example C Programming Example
C Programming Example
 
week-3x
week-3xweek-3x
week-3x
 
Dam31303 dti2143 lab sheet 7
Dam31303 dti2143 lab sheet 7Dam31303 dti2143 lab sheet 7
Dam31303 dti2143 lab sheet 7
 
LAB_MANUAL_cpl_21scheme-2.pdf
LAB_MANUAL_cpl_21scheme-2.pdfLAB_MANUAL_cpl_21scheme-2.pdf
LAB_MANUAL_cpl_21scheme-2.pdf
 
Cs291 assignment solution
Cs291 assignment solutionCs291 assignment solution
Cs291 assignment solution
 
Data Structure using C
Data Structure using CData Structure using C
Data Structure using C
 
You are to write a program that computes customers bill for hisher.docx
 You are to write a program that computes customers bill for hisher.docx You are to write a program that computes customers bill for hisher.docx
You are to write a program that computes customers bill for hisher.docx
 
C- Programming Assignment 4 solution
C- Programming Assignment 4 solutionC- Programming Assignment 4 solution
C- Programming Assignment 4 solution
 
'C' language notes (a.p)
'C' language notes (a.p)'C' language notes (a.p)
'C' language notes (a.p)
 
All important c programby makhan kumbhkar
All important c programby makhan kumbhkarAll important c programby makhan kumbhkar
All important c programby makhan kumbhkar
 

More from raheeema suleman

Computing_Year 10_Track 1_Student Paper.pdf
Computing_Year 10_Track 1_Student Paper.pdfComputing_Year 10_Track 1_Student Paper.pdf
Computing_Year 10_Track 1_Student Paper.pdfraheeema suleman
 
11th Computer Science Helping Book.pdf
11th Computer Science Helping Book.pdf11th Computer Science Helping Book.pdf
11th Computer Science Helping Book.pdfraheeema suleman
 
Grade 6 Practical Task Revision Sheet.docx
Grade 6 Practical Task Revision Sheet.docxGrade 6 Practical Task Revision Sheet.docx
Grade 6 Practical Task Revision Sheet.docxraheeema suleman
 
Pinpoint learning-density-problems-solutions
Pinpoint learning-density-problems-solutionsPinpoint learning-density-problems-solutions
Pinpoint learning-density-problems-solutionsraheeema suleman
 

More from raheeema suleman (7)

Computing_Year 10_Track 1_Student Paper.pdf
Computing_Year 10_Track 1_Student Paper.pdfComputing_Year 10_Track 1_Student Paper.pdf
Computing_Year 10_Track 1_Student Paper.pdf
 
11th Computer Science Helping Book.pdf
11th Computer Science Helping Book.pdf11th Computer Science Helping Book.pdf
11th Computer Science Helping Book.pdf
 
Computer MCQS.docx
Computer MCQS.docxComputer MCQS.docx
Computer MCQS.docx
 
Grade 6 Practical Task Revision Sheet.docx
Grade 6 Practical Task Revision Sheet.docxGrade 6 Practical Task Revision Sheet.docx
Grade 6 Practical Task Revision Sheet.docx
 
Wk 1 9
Wk 1 9Wk 1 9
Wk 1 9
 
Pinpoint learning-density-problems-solutions
Pinpoint learning-density-problems-solutionsPinpoint learning-density-problems-solutions
Pinpoint learning-density-problems-solutions
 
Ssc s-computer-science
Ssc s-computer-scienceSsc s-computer-science
Ssc s-computer-science
 

Recently uploaded

A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)Christopher H Felton
 
Russian Call Girls Thane Swara 8617697112 Independent Escort Service Thane
Russian Call Girls Thane Swara 8617697112 Independent Escort Service ThaneRussian Call Girls Thane Swara 8617697112 Independent Escort Service Thane
Russian Call Girls Thane Swara 8617697112 Independent Escort Service ThaneCall girls in Ahmedabad High profile
 
Denver Web Design brochure for public viewing
Denver Web Design brochure for public viewingDenver Web Design brochure for public viewing
Denver Web Design brochure for public viewingbigorange77
 
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With RoomVIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Roomishabajaj13
 
On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024APNIC
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITMgdsc13
 
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...aditipandeya
 
Russian Call girls in Dubai +971563133746 Dubai Call girls
Russian  Call girls in Dubai +971563133746 Dubai  Call girlsRussian  Call girls in Dubai +971563133746 Dubai  Call girls
Russian Call girls in Dubai +971563133746 Dubai Call girlsstephieert
 
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...SofiyaSharma5
 
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012rehmti665
 
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Dana Luther
 
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779Delhi Call girls
 
Complet Documnetation for Smart Assistant Application for Disabled Person
Complet Documnetation   for Smart Assistant Application for Disabled PersonComplet Documnetation   for Smart Assistant Application for Disabled Person
Complet Documnetation for Smart Assistant Application for Disabled Personfurqan222004
 
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607dollysharma2066
 
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Gram Darshan PPT cyber rural in villages of india
Gram Darshan PPT cyber rural  in villages of indiaGram Darshan PPT cyber rural  in villages of india
Gram Darshan PPT cyber rural in villages of indiaimessage0108
 
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts servicesonalikaur4
 

Recently uploaded (20)

A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
 
Russian Call Girls Thane Swara 8617697112 Independent Escort Service Thane
Russian Call Girls Thane Swara 8617697112 Independent Escort Service ThaneRussian Call Girls Thane Swara 8617697112 Independent Escort Service Thane
Russian Call Girls Thane Swara 8617697112 Independent Escort Service Thane
 
Denver Web Design brochure for public viewing
Denver Web Design brochure for public viewingDenver Web Design brochure for public viewing
Denver Web Design brochure for public viewing
 
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With RoomVIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Room
 
On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITM
 
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...
 
Russian Call girls in Dubai +971563133746 Dubai Call girls
Russian  Call girls in Dubai +971563133746 Dubai  Call girlsRussian  Call girls in Dubai +971563133746 Dubai  Call girls
Russian Call girls in Dubai +971563133746 Dubai Call girls
 
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
 
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
 
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
 
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
 
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
 
Complet Documnetation for Smart Assistant Application for Disabled Person
Complet Documnetation   for Smart Assistant Application for Disabled PersonComplet Documnetation   for Smart Assistant Application for Disabled Person
Complet Documnetation for Smart Assistant Application for Disabled Person
 
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
 
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
 
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
 
Gram Darshan PPT cyber rural in villages of india
Gram Darshan PPT cyber rural  in villages of indiaGram Darshan PPT cyber rural  in villages of india
Gram Darshan PPT cyber rural in villages of india
 
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
 

C language program

  • 1. C Language Program Write a C program to input electricity unit charge and calculate the total electricity bill according to the given condition: For first 50 units Rs. 0.50/unit For next 100 units Rs. 0.75/unit For next 100 units Rs. 1.20/unit For unit above 250 Rs. 1.50/unit An additional surcharge of 20% is added to the bill. How to calculate electricity bill using if else in C programming. Program to find electricity bill using if else in C. Logic to find net electricity bill in C program. /** * C program to calculate total electricitybill */ #include <stdio.h> int main() { int unit; floatamt, total_amt,sur_charge; /* * Read unitconsumedfromuser */ printf("Entertotal unitsconsumed:"); scanf("%d",&unit); /* * Calculate electricitybillaccordingtogivenconditions */ if(unit<= 50) { amt = unit* 0.50; } else if(unit<= 150) { amt = 25 + ((unit-50)*0.75); } else if(unit<= 250) { amt = 100 + ((unit-150)*1.20); } else { amt = 220 + ((unit-250)*1.50); } /* * Calculate total electricitybill * afteraddingsurcharge */ sur_charge = amt * 0.20; total_amt = amt + sur_charge; printf("ElectricityBill =Rs. %.2f",total_amt); return0;
  • 2. } to display the larger one out of the three given unequal numbers #include <stdio.h> intmain() { double n1,n2, n3; printf("Enterthree numbers:"); scanf("%lf %lf %lf",&n1, &n2, &n3); if( n1>=n2 && n1>=n3 ) printf("%.2f isthe largestnumber.",n1); if( n2>=n1 && n2>=n3 ) printf("%.2f isthe largestnumber.",n2); if( n3>=n1 && n3>=n2 ) printf("%.2f isthe largestnumber.",n3); return0; }
  • 3. Write a Program to inputname,classand marksin five Subjectslike English,math,Nepali,account, Computerscience FindTotal,percentage,division,remarksThe conditionof divisionis.. :Percentage / Division:per>= 75 / Distinction,per>=60 AND per<75 / Firstper> = 45 AND per<60 / Second,per>= 35 ANDper <45 / Third and Below-35/Fail. #include <stdio.h> #include <conio.h> voidmain() { char name [50]; intclas, eng,nep,math,acc, cscience,total; floatper; printf ("Enterthe name of student:"); scanf ("% s",& name); printf ("Enterthe class:"); scanf ("% d",& clas); printf ("Enterthe marksin English,Nepali,Math,AccountandComputerScience."); scanf ("% d%d% d%d% d",& eng,& nep,& math,& acc, & cscience); printf ("t nName =% s",name); printf ("t nClass=% d", clas); printf ("nEnglish= t%d", eng); printf ("nNepali = t% d",nep); printf ("nMath = t%d", math); printf ("nAccount= t%d", acc); printf ("nComputerScience = t%d", cscience); printf ("n ==============================="); total = eng+ nep+ math + acc + cscience; per= total / 5; printf ("Total = t% d",total); printf ("Percentage =t% f",per); if (eng>= 35 && nep> = 35 && math> = 35 && acc> = 35 && cscience>= 35) printf ("nRemarks:PASSED"); else printf ("nRemarks:FAILED"); if (per>= 75) printf ("Division:Distnction"); else if (per>= 60 && per<75) printf ("Division:First"); else if (per>= 45 && per<60) printf ("Division:Second"); else if (per>= 35 && per<45) printf ("Division:Third"); else printf ("Division:Fail"); getch(); }
  • 4. Program to calculate simple interest /* * C program to calculate simple interest */ #include <stdio.h> int main() { float principle, rate, time, simpleInterest; /* * Take Principle, Rate of interest and * Time as input from user. */ printf("Enter Principle Amountn"); scanf("%f", &principle); printf("Enter Rate of Interestn"); scanf("%f", &rate); printf("Enter Time of Loann"); scanf("%f", &time); /* * Simple Interest = (Principle X Rate X Time)/100; */ simpleInterest = (principle * rate * time)/100; printf("Simple Interest = %.2f", simpleInterest); return 0; }
  • 5. to determine whether a given number is prime number or not #include <stdio.h> intmain() { int n,i, flag= 0; printf("Enterapositive integer:"); scanf("%d",&n); for(i=2;i<=n/2; ++i) { //conditionfornonprime number if(n%i==0) { flag=1; break; } } if (flag==0) printf("%disaprime number.",n); else printf("%disnotaprime number.",n); return0; }