0% found this document useful (0 votes)
18 views3 pages

A Program in C Calculate Root of Quadratic Equation For General Form of Quadratic Equation Ax 2+bx+c 0

The document contains the code for 3 C programs written by a student with Roll No. 17087: 1) A program to calculate the roots of a quadratic equation by taking inputs for coefficients a, b, c and using the quadratic formula. 2) A program to check if a number is a palindrome by reversing the number and comparing it to the original. 3) A program to print the first 10 multiples of a number entered by the user.

Uploaded by

MohitManuja
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views3 pages

A Program in C Calculate Root of Quadratic Equation For General Form of Quadratic Equation Ax 2+bx+c 0

The document contains the code for 3 C programs written by a student with Roll No. 17087: 1) A program to calculate the roots of a quadratic equation by taking inputs for coefficients a, b, c and using the quadratic formula. 2) A program to check if a number is a palindrome by reversing the number and comparing it to the original. 3) A program to print the first 10 multiples of a number entered by the user.

Uploaded by

MohitManuja
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Roll No: 17087

Exp:5

1/09/2014

Aim: Write a program in c calculate root of Quadratic Equation for general


form of quadratic equation ax^2+bx+c =0
#include <stdio.h>
#include <conio.h>
#include<math.h>
int main()
{
int a,b,c,d;
float x1,x2;
printf("enter the value of a,b & c\n");
scanf("%d%d%d",&a,&b,&c);
d=b*b-4*a*c;
if(d==0)
{
printf("Both roots are equal\n");
x1=-b/(2*a);
x2=x1;
printf("First Root x1= %f\n",x1);
printf("Second Root x2= %f\n",x2);
}
else
if(d>0)
{
printf("Both roots are real and diffent\n");
x1=(-b+sqrt(d))/(2*a);
x2=(-b-sqrt(d))/(2*a);
printf("First Root x1= %f\n",x1);
printf("Second Root x2= %f\n",x2);
}
else
printf("Root are imeginary\n No Solution \n");
getch();
}

Roll No: 17087

Exp:6

1/09/2014

Aim: Write a program in c to check number is palindrome or not.


#include <stdio.h>
#include<conio.h>
int main()
{
int n,r,k,temp,rev;
printf("Enter the number : ");
scanf("%d",&n);
rev=0;
temp=n;
while(n!=0)
{
r=n%10;
rev=rev*10+r;
n=n/10;
}
if(rev==temp)
{
printf(" Number is palindrome ");
}
else
{
printf("Number is not palindrome");
}
getch();
}

Output:

Roll No: 17087

Exp:7

Aim: Write a program in c to print first multiple of a number.


#include<stdio.h>
#include<conio.h>
int main()
{
int i,n,x;
// clrscr();
printf("Enter the number : ");
scanf("%d",&n);
x=1;
i=1;
while(i<=10)
{
x=n*i;
printf("%d\n",x);
i++;
}
getch();
}

Output:

1/09/2014

You might also like