Saturday, February 1, 2020

Area of Square

#include<stdio.h>
#include<conio.h>

void main()
{
   float side;
 
   printf("Enter length of a side:");
   scanf("%f",&side);
 
   printf("Area of Square is: %.2f", side*side);
getch();
}


https://www.onlinegdb.com/online_c_compiler
https://drive.google.com/file/d/17SAl_spSUGitln-MMUNeSZ9r9SOn7pXK/view?usp=sharing

Bill Program

#include <stdio.h>
#include <conio.h>

int main()
{
int pvunit, ptunit, unit;
float amt, total_amt, tax;

printf("Enter total Previous units: ");
scanf("%d", &pvunit);

printf("Enter total Present units: ");
scanf("%d", &ptunit);

unit=ptunit-pvunit;
amt = unit * 15.84;
tax = amt*0.20;
total_amt = amt+tax;
printf("\n Consumed Unit = %d", unit);
printf("\nUnit Bill = Rs. %.2f", amt);
printf("\nTax = Rs. %.2f", tax);
printf("\nElectricity Bill = Rs. %.2f", total_amt);

getch();
}

Area of Circle

#include<stdio.h>
#include<conio.h>
void main()
{
   float r;
   
   printf("Enter radius:");
   scanf("%f",&r);
   
   printf("Area of Circle is: %.2f", 3.14*r*r);
    getch();
}

Float Addition

#include<stdio.h>
#include<conio.h>
int main()
{
   float f1,f2;
   int total;

   printf("Enter your floating point number1:");
   scanf("%f",&f1);

   printf("Enter your floating point number2:");
   scanf("%f",&f2);

   total = f1 + f2;

   printf("Total is: %d ",total);
getch();
}

Name printf

#include<stdio.h>
#include<conio.h>

int main()
{
            printf("Name: Farhan \n");
            printf("Address: 11-F.B Area, Karachi \n");
            printf("Karachi, Sindh, Pakistan.");
            getch();
}

Basic Calculator

#include<stdio.h>
#include<conio.h>
int main()
{
 int a, b, c, d, e, f;

 printf("Enter your number1:");
 scanf("%d",&a);

 printf("Enter your number2:");
 scanf("%d",&b);

c=a+b;
d=a-b;
e=a*b;
f=a/b;

 printf("Add: %d=%d+%d \n", c,a,b);
 printf("Sub: %d=%d-%d \n", d,a,b);
 printf("Multiply: %d=%dx%d \n", e,a,b);
 printf("Divide: %d=%d/%d \n", f,a,b);
getch();
}

Addition in C

#include<stdio.h>
#include<conio.h>
int main()
{
 int number1, number2;

 printf("Enter your number1:");
 scanf("%d",&number1);

 printf("Enter your number2:");
 scanf("%d",&number2);

 printf("Addition=%d", number1 + number2);
getch();
}