Basic algebra formulas that you can revise anytime and anywhere

FORMULAS FOR BEGINNER (a+b) ^2= a^2+b^2+2ab (a+b) ^2= (a-b) ^2+4ab (a-b) ^2= a^2+b^2-2ab (a-b) ^2= (a+b) ^2-4ab a^2+b^2= (a+b) ^2-2ab a^2+b^2= (a-b) ^2+ 2ab a^2-b^2= (a+b) (a-b) (a+b+c) ^2= a^2+b^2+c^2+2(ab+bc+ac) (a-b-c) ^2= a^2+b^2+c^2-2(ab-bc+ac) (a+b) ^3= a^3+b^3+3ab(a+b) (a-b) ^3= a^3-b^3+3ab(a-b) a^3+b^3= (a+b) (a^2-ab+b^2) a^3-b^3= (a-b) (a^2+ab+b^2) a^4-b^4= (a^2-b^2) (a^2+b^2) = (a^2+b^2) (a+b) (a-b) a^5+b^5= (a+b) (a^4-a^3b+a^2b^2-ab^3+b^4) a^5-b^5= (a-b) (a^4+a^3b+a^2b^2+ab^3+b^4)

Random c programming coding




Odd or Even

#include < stdio.h >
main()
{
int n;
printf("Enter an integer\n");
scanf("%d",&n);
if ( n%2 == 0 )
printf("Even\n");
else
printf("Odd\n");
return 0;
}


Greatest of 3 numbers

#include < stdio.h >
void main()
{
int a,b,c;
printf("enter any three numbers:\n");
scanf("%d%d%d",&a, &b, &c);
if(a>b&&a>c)
printf("greatest number is: %d",a);
else if(b>c)
printf("greatest number is: %d",b);
else
printf("greatest number is: %d",c);
}


Swapping two numbers

#include < stdio.h >
int main()
{
int x, y, temp;
printf("Enter the value of x and y\n");
scanf("%d%d", &x, &y);
printf("Before Swapping\nx = %d\ny = %d\n",x,y);
temp = x;
x = y;
y = temp;
printf("After Swapping\nx = %d\ny = %d\n",x,y);
return 0;
}


Nested If Else

#include < stdio.h >
void main()
{
int marks;
printf("Enter your marks : ");
scanf("%d",&marks);
if(marks>100)
/*marks greater than 100*/
printf("Not valid marks");
else if(marks>=80)
/*marks between 80 & 99*/
printf("your grade is A");
else if(marks >=70)
/*marks between 70 & 79*/
printf("your grade is B");
else if(marks>=50)
/*marks between 50 & 69*/
printf("your grade is C");
else if(marks>=35)
/*marks between 35 & 49*/
printf("your grade is D");
else
/*marks less than 35*/
printf("your grade is E");
}


Calculate percentage

#include < stdio.h >
void main()
{
int s1, s2, s3, s4, s5, sum, total = 500;
float per;
printf("\nEnter marks of 5 subjects : ");
scanf("%d %d %d %d %d", &s1, &s2, &s3, &s4, &s5);
sum = s1 + s2 + s3 + s4 + s5;
printf("\nSum : %d", sum);
per = (sum * 100)/500;
/* percentage formula*/
printf("\nPercentage : %f", per);
}


Calculate Gross salary

#include < stdio.h >
void main()
{
int gross_salary, basic, da, ta;
printf("Enter basic salary : ");
scanf("%d", &basic);
da = (10 * basic)/100;
ta = (12 * basic)/100;
gross_salary = basic + da + ta;
printf("\nGross salary : %d",gross_salary);
}


Simple interest

#include < stdio.h >
void main()
{
int amount, rate, time, ans;
printf("\nEnter Principal Amount : ");
scanf("%d", &amount);
printf("\nEnter Rate of Interest : ");
scanf("%d", &rate);
printf("\nEnter Period of Time : ");
scanf("%d", &time);
ans = (amount * rate * time)/100;
/*Simple interest formula*/
printf("\nSimple Interest : %d",ans);
}


These are the Concept of C programming . We'll be glad if you share your valuable information with us regarding this topic, then it will be a golden opportunity for all of us to improve ourselves and know more. Comment below!!

Comments

Popular posts from this blog

How to answer " What are your goals?"(HR QUESTION)

Basic algebra formulas that you can revise anytime and anywhere