Posts

Functions and recrusion.

1.Write a program using functions to find the average of three numbers. #include <stdio.h> float average ( int a, int b, int c); int main (){     int a , b , c ;     printf ( "Enter the value of a" );     scanf ( " %d " , & a );     printf ( "Enter the value of b" );     scanf ( " %d " , & b );     printf ( "Enter the value of c" );     scanf ( " %d " , & c );     printf ( "The average is %f " , average ( a , b , c )); } float average ( int a, int b, int c){     float res ;     res = (a + b + c) / 3 ;     return res ; } 2.Write a function to convert Celcius temperature into Fahrenheit. #include <stdio.h> float far ( float a); int main (){     float a ;     printf ( "Enter the Temparature in celsius:" );     scanf ( " %f " , & a );     printf ( "The temprature in Farenheit: %f " , far ( a )); } ...

Quick calculator using HTML,CSS and Java Script.

Image
 >>HTML codes. <! DOCTYPE html > < html lang = "en" > < head >     < meta charset = "UTF-8" >     < meta name = "viewport" content = "width=device-width, initial-scale=1.0" >     < link rel = "stylesheet" href = "cal.css" >     < title >Calculator</ title > </ head > < body >     < div class = "calculator" >         < input type = "text" id = "display" disabled >         < div class = "buttons" >             < button onclick = " appendToDisplay ( '7' ) " >7</ button >             < button onclick = " appendToDisplay ( '8' ) " >8</ button >             < button onclick = " appendToDisplay ( '9' ) " >9</ button >             < button onclick...

Site to calculate electricity bill using HTML, CSS and Java Script

Image
 >> HTML code to enter customer name, customer id and units consumed. <! DOCTYPE html > < html lang = "en" > < head >   < meta charset = "UTF-8" >   < meta name = "viewport" content = "width=device-width, initial-scale=1.0" >   < link rel = "stylesheet" href = "styles.css" >   < title >Electricity Bill Calculator</ title > </ head > < body >   < div class = "container" >     < h1 >Electricity Bill Calculator</ h1 >     < form id = "bill-form" >       < label for = "name" >Name:</ label >       < input type = "text" id = "name" required >< br >             < label for = "id" >Customer ID:</ label >       < input type = "text" id = "id" required >< br >             < label for = "...

Let us C Chapter 2

[C] Attempt the following:  (a) If cost price and selling price of an item is input through the keyboard, write a program to determine whether the seller has made profit or incurred loss. Also determine how much profit he made or loss he incurred.  #include <stdio.h> int main (){     int sp , cp ;     printf ( "Enter the cost price: " );     scanf ( " %d " , & cp );     printf ( "Enter the selling price:" );     scanf ( " %d " , & sp );     if ( sp > cp )     {         printf ( "Seller is inProfit = %d " , sp - cp );     }     else { printf ( "Seller  is in Loss = %d " , cp - sp );} }   (b) Any integer is input through the keyboard. Write a program to find out whether it is an odd number or even number. include <stdio.h> int main (){     int a ;     printf ( "Enter the intger: " );     scanf ( " %d " ,...

Let us C Chapter 1.(H)

 (a)Ramesh’s basic salary is input through the keyboard. His dearness allowance is 40% of basic salary, and house rent allowance is 20% of basic salary. Write a program to calculate his gross salary. #include <stdio.h> int main (){ int bs , gs ; printf ( "Enter basic salary: " ); scanf ( " %d " , & bs ); gs = bs + ( bs * 40 / 100 ) + ( bs * 20 / 100 ); printf ( "Gross salary is %d " , gs ); } (b) The distance between two cities (in km.) is input through the keyboard. Write a program to convert and print this distance in meters, feet, inches and centimeters.  #include <stdio.h> int main () {     int m , c ;     float d , f ;     printf ( "Distance between two cities(in km): " );     scanf ( " %f " , & d );     m = d * 1000 ; f = d * 3280.84 ; c = d * 100000 ;     printf ( " %f is equal to %d metres. \n " , d , m );     printf ( " %f is equal to %f feet. \n " , d , f );   ...