| Back to Questions Page |
| |
| Question |
program to find the roots of a quadratic equation |
Rank |
Answer Posted By |
|
Question Submitted By :: Nithya |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | #include<stdio.h>
#include<conio.h>
#include<math.h>
#include<process.h>
void main()
{
float a,b,c,x1,x2,disc;
clrscr();
printf("Enter the co-efficients\n");
scanf("%f%f%f",&a,&b,&c);
disc=b*b-4*a*c;/*to find discriminant*/
if(disc>0)/*distinct roots*/
{
x1=(-b+sqrt(disc))/(2*a);
x2=(-b-sqrt(disc))/(2*a);
printf("The roots are distinct\n");
exit(0);
}
if(disc==0)/*Equal roots*/
{
x1=x2=-b/(2*a);
printf("The roots are equal\n");
printf("x1=%f\nx2=%f\n",x1,x2);
exit(0);
}
x1=-b/(2*a);/*complex roots*/
x2=sqrt(fabs(disc))/(2*a);
printf("The roots are complex\n");
printf("The first root=%f+i%f\n",x1,x2);
printf("The second root=%f-i%f\n",x1,x2);
getch();
}  |
| Dhananjay |
| |
| |
| Question |
What do you create for easier access of data? |
Rank |
Answer Posted By |
|
Question Submitted By :: Guest |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | To Connect With SQL-Server & Access Data  |
| Parmod Malik |
| |
| |
| Question |
In the Design view in Visual Studio 2005 of an ASP.NET web
page, what is the easiest way to create an event handler for
the default event of an ASP.NET server control? |
Rank |
Answer Posted By |
|
Question Submitted By :: Guest |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | Double click on the control in the design this would automatically create an empty event handler for the specific control.  |
| Ravindra Mohan |
| |
| |
|
|
| |
| Question |
What is "far" and "near" pointers in "c"...? |
Rank |
Answer Posted By |
|
Question Submitted By :: Mariaalex007 |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | I think it's kind of pointer for different computer
architecture such as X86, IBM power server and so on because
various model of memory model is different.  |
| Peter |
| |
| |
| Answer | "near" and "far" pointers are actually non-standard
qualifiers that you'll find only on x86 systems. They
reflect the odd segmentation architecture of Intel
processors. In short, a near pointer is an offset only,
which refers to an address in a known segment. A far pointer
is a compound value, containing both a segment number and an
offset into that segment.
Segmentation still exists on Intel processors, but it is not
used in any of the mainstream 32-bit operating systems
developed for them, so you'll generally only find the "near"
and "far" keywords in source code developed for Windows 3.x,
MS-DOS, Xenix/80286, etc.  |
| Narasimha [PSNCET] |
| |
| |
| Question |
What is the main difference between STRUCTURE and UNION? |
Rank |
Answer Posted By |
|
Question Submitted By :: Mariaalex007 |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | All the members of the structure can be accessed at
once,where as in an union only one member can be used at a time.
Another important difference is in the size allocated to a
structure and an union.
for eg:
struct example
{
int integer;
float floating_numbers;
}
the size allocated here is sizeof(int)+sizeof(float);
where as in an union
union example
{
int integer;
float floating_numbers;
}
size allocated is the size of the highest member.
so size is=sizeof(float);  |
| Vijay Nag |
| |
| |
| Answer | 1) Structure: The size in bytes is the sum total of size of
all the elements in the structure, plus padding bytes.
2) Size of in bytes of the union is size of the largest
variable element in the union.
i.e In case of Union, the elements making up the
union 'overlap' in memory OR they are accessed as diffrent
name/type at diffrent places in the program.
Whereas in case of Struct, each of the elements have a
distinct identity.  |
| Ravi [PSNCET] |
| |
| |
| Answer | The difference between structure and union in c are: 1.
union allocates the memory equal to the maximum memory
required by the member of the union but structure allocates
the memory equal to the total memory required by the
members. 2. In union, one block is used by all the member
of the union but in case of structure, each member have
their own memory space  |
| Dinesh Haridoss [PSNCET] |
| |
| |
|
| |
|
Back to Questions Page |