ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   SiteMap shows list of All Categories in this site.
Google
 
Categories >> Code-Snippets >> Programming-Code
 
  C-Code (64)  C++-Code (33)  Visual-Basic-Code (2)  Programming-Code-AllOther (6)
 


 

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();
}
 
0
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
 
0
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.
 
0
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.
 
0
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.
 
0
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);
 
5
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.
 
0
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
 
0
Dinesh Haridoss
[PSNCET]
 
 
 
Back to Questions Page
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com