C Program
C Program
#include<math.h>
void main () {
int x1,x2,y1,y2,distance;
printf(“ enter the points :”);
scanf(“%d%d%d%d”,&x1,&x2&,y1,&y2);
Dis=sqrt(pow((x2-x1),2)+pow((y2-y1),2));
Printf(“Distance between the two points :%d\n”,Dis);
}
c = a+b;
printf("a+b = %d \n",c);
c = a-b;
printf("a-b = %d \n",c);
c = a*b;
printf("a*b = %d \n",c);
c = a/b;
printf("a/b = %d \n",c);
c = a%b;
return 0;
}
int main() {
int num1, num2, num3;
cout << "Enter three numbers: ";
cin >> num1 >> num2 >> num3;
int largest = (num1 > num2) ? ((num1 > num3) ? num1 : num3) : ((num2 > num3) ? num2 :
num3);
cout << "The largest number is: " << largest << endl;
return 0;
}
{
char uppercase,lowercase;
int ascii;
printf(“Enter a character:”);
scanf(“%c”,&uppercase);
ascii=uppercase;
printf(“ASCCII=%d”,ascii);
lowercase=ascii+32;
printf(“The lowercase character is %d”,lowercase);
return 0;
scanf(“%d”,&num1);
printf(“Enter the second number:”);
scanf(“%d”,&num2);
temp=num1;
num1=num2;
num2=temp;
printf(“After swapping, the first number is:%d\n”,num1);
printf(“After swapping, the second number is:%d\n”,num2);
return 0;
}
num1=num1+num2;
num2=num1-num2;
num1=num1-num2;
printf(“After swapping, the first number is:%d\n”,num1);
printf(“After swapping, the second number is:%d\n”,num2);
return 0;
}
#include <stdio.h>
int main() {
float q=5,v=20,d=5,t=5,amt,dis_amt,tax_amt,sub_total,total;
amt=q*v;
dis_amt=(amt*d)/100;
sub_total=amt-dis_amt;
tax_amt=(sub_total*t)/100;
total=sub_total+tax_amt;
printf("\n\n\n******BILL******\n");
printf("Quantity Sold:%f\n",q);
printf("Total Amount:%f",total);
return 0;
}
#include <stdio.h>
int main()
{
float p=2000,t=1,r=1;
float si=(p*t*r)/100;
printf("Simple Interest = %f\n",si);
float amt=p*((pow((1+r/100),t)));
float ci=amt-p;