Monday, July 13, 2020

Program of electricity board

 Q.......Develop a program of electricity board of calculating bill of consumer based on unit consumption
                  

             UNIT                                                                RATE
           
            First 100                                                         5.10
            Second 101-150                                             6.20
            Next  151-250                                                 7.10
            Next 251                                                         8.40
             

#include<stdio.h>
#include<conio.h>
int main()
{
int unit;
float bill;
printf("input reading in unit:");
scanf("%d",&unit);
if(unit<=100)
bill=unit*5.70;
else if(unit<=150)
bill=100*5.70+(unit-100)*6.20;
else if(unit<=250)
bill=100*5.70+50*6.20+(unit-150)*7.10;
else
bill=100*5.70+50*6.20+50*7.10+(unit-250)*8.40;
printf("Net bill=%.2f",bill+200);
getch();
}

Write c program that accept radius of circle and prints its are and circumference

#include<stdio.h>
#include<conio.h>
int main()
{
float r,a,c;
printf("input radius of a circle in cm:");
scanf("%f",&r);
a=3.14*r*r;
c=2*3.14*r;
printf("area=%.2fsq cm\n",a);
printf("circumference=%.2fsq cm",c);
getch();
}
                                  

                                              AHAD🙏

Sunday, July 12, 2020

C PROGRAM TO FIND A FACTORIAL NUMBER

#include<stdio.h>
#include<conio.h>
int main()
{
int a;
long int fact=1;
printf("input a whole nos:");
scanf("%d".&a);
while(n>1)
{
fact=fact*a;
a--;
}
printf("factorial=%ld",fact);
getch();
}
                              AHAD🙏🙏                                    

C LANGUAGE

 

AHAD HUSSAIN





   What is computer language/programming language?
A computer language consist of set of rules,syntax,and symbols that allows to communicate with computer.
Any kind of software can develop through computer language hence, it is also called programming language.
                             There are two types of computer language....
  1.                              LOW  LEVEL  LANGUAGE  (LLL)
  2.                              HIGH  LEVEL  LANGUAGE  (HLL)
              

LOW LEVEL LANGUAGE:- In this language, instruction are written close to hardware language i:s in 0 and 1.

Advantage
  • Program execution is fast
  • System software can be develop
Disadvantage
  • Difficult to learn
  • Low productivity
  • Non-portable i:s a program develop on one computer can't run on another computer
Example
  • 1st Generation Language (Machine language)
  • 2nd Generation Language (Assembly language)
HIGH LEVEL LANGUAGE:-In this language, instruction are written close to english words.

 Advantage
  • Program became very easy
  • Large and complex software can be developed quickly 
  • Portable i:s a program develop on one computer can run on another computer
Disadvantage
  • System software can't be develop
  • Program execution is slow 

      Example
  • 3rd Generation Language (3GL)
  • 4th Generation Language (4GL)

Program of electricity board

 Q.......Develop a program of electricity board of calculating bill of consumer based on unit consumption                                 UN...