We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 8
UNIT 2:
CONSTANTS , VARIABLES AND
DATA TYPES IN C AND OPERATORS AND EXPRESSIONS AND INPUT , OUTPUT FUNCTIONS IN C . WRITE A C PROGRAM TO FIND THE ROOTS OF THE QUADRATIC EQUATION . #include <stdio.h> #include <conio.h> void main() { float a , b, c, d , e , f , g , x , y ; clrscr() printf(“enter a , b ,c values :\n”); scanf(“%f %f %f”, &a, &b , &c); d=b*b-4*a*c; e=sqrt(d); f=2*a; x=(-b + e)/f; y=(-b-e)/f; printf(“x=%f y=%f , x, y); getch( ); } INPUT : Enter a , b , c values : OUTPUT : X=3.00 Y=2.00 WRITE A C PROGRAM TO CALCULATE SIMPLE INTREST #include<stdio.h> #include<conio.h> void main( ) { int p , t , r; float si; printf(“enter price,time and rate of intrest :\n”); scanf(“%d %d %d”, &p , &t , &r); si=(p*t*r)/100; printf(“simple intrest =%f”si); getch( ); } INPUT : Enter price , time and rate of intrest 3500 5 2 OUTPUT: simple intrest =350.000000