answersLogoWhite

0


Best Answer

#include<stdio.h>

#include<conio.h>

void main()

{

int x1, x2, x3, y1, y2, y3 ;

printf("\nEnter the Co-ordinates of first point(x1,y1)");

scanf("d",&1x, &y1);

printf("\nEnter the Co-ordinates of 2nd point(x2,y2)");

scanf("d",&x2, &y2);

printf("\nEnter the Co-ordinates of 3rd point(x3,y3)");

scanf("d",&x3, &y3);

if( (y2-y1)/(x2-x1)==(y3-y2)/(x3-x2) )

printf("The three points lie on straight line");

else

printf("The three points do not lie on straight line");

getch();

}

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Given three points x1y1x2y2 x3y3 write a program to check if all three points fall on one straight line using only conditional statementsififelse nested if only?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What is platform dependency of c plus plus?

C++ has no platform dependency. If a compiler exists for a platform (and few don't) code can be written for that platform. Where platforms have different methods to do the same thing, conditional compilation can be used to cater for those differences, thus the same source code can be compiled on any platform simply by changing the definitions used by the conditional compilation directives. For instance, a program that caters for Unix and Windows platforms might contain the following conditional compilation: #ifdef __unix__ #include &lt;unistd.h&gt; #elif defined _WIN32 #include &lt;windows.h&gt; #endif The definition of __unix__ and _WIN32 must be mutually exclusive.


When you need to satisfy two or more criteria to initiate an event in a program you must make sure that the second decision is made entirely independently of the first decision?

Evaluate the criteria before executing the conditional expression. In pseudocode:result1 = evaluate( criteria1 );result2 = evaluate( criteria2 );if( result1 && result2 ) initiate_event;Note that this is not the same as the following:if( evaluate( criteria1 ) && evaluate( criteria2 )) initiate_event;If the evaluation of criteria1 fails for any reason, then the whole expression fails and criteria2 is never evaluated. so if the evaluations must be done independently of each other, then they must be done prior to the conditional expression, storing the results for use in the conditional expression.


What are the different symbols used in a program flow chart?

The most widely used symbols are:1. Start and end2. Arrows3. Processing steps3. Conditional Other symbols are:4. document symbol5. Manual Operation6. Data file


What are two unconditional statements in Qbasic?

UNCONDITIONAL STATEMENT - EXAMPLE 1 In order to understand what is an 'unconditional' statement; you would first need to understand what is it's opposite, namely, what does a 'conditional' statement mean? In the world of computer programming, a 'conditional' statement is a logical test...; which tests to see if a certain condition has been met...; before producing any further result. x = 1 IF x = 1 THEN PRINT "One" ELSE PRINT "NOT one" The conditional test here is...IF x = 1?...only, then, will the word, "One", get printed out; but, on the other hand, if x does NOT = 1...then, the words, "NOT one", will get printed out, instead. This, I'm sure, you'll agree is really quite logical. The above example can now be compared with using an unconditional imperative statement...which doesn't use any form of logical check...before producing any further result. x = 2 PRINT "One" ...Here no logical conditional test has been carried out, first; to check to see if variable x really is equal to 1...and, instead, quite unconditionally, the word, "One", is printed out...as being a strictly imperative command...not being based on any conditional test. Using an unconditional wholly imperative command is like saying...do this...regardless of what the actual condition(s) is/are...which is, most probably, NOT what the programmer's original intentions were to be able to achieve...?! UNCONDITIONAL STATEMENT - EXAMPLE 2 Again, I will start off by showing you a 'conditional' test statement; followed by showing you an 'unconditional' statement which doesn't use any test. In this case the statement we are going to use is the DO/LOOP; which is, usually, used to repeat statements that are being written inside the middle of it. count% = 0 CLS DO count% = count% + 1 PRINT count% LOOP UNTIL count% = 3 END In this case the loop uses a variable called, count, which begins with the value 0 outside of the loop...this is called, initialising a variable by giving it a value first before you start using it...which is good programming language technique; inside of the DO/LOOP the value of count is incremented by +1; and, next, this value gets printed out by using the PRINT statement; the last line of the loop is a 'conditional' test statement...LOOP UNTIL count% = 3...which checks to see if the count variable has reached the value 3...if the conditional test is NOT true the loop continues counting upwards...; but, if the conditional test does eventually become true, then, the loop stops counting...whenever the value of count does become equal to 3...and, the program breaks out of the loop...to reach it's final END statement; which is where the program stops running. We can compare the above loop being based on a 'conditional' test; to one without any conditional test...in other words, an 'unconditional' loop... count%=0 CLS DO count% = count% + 1 PRINT count% LOOP END This last example doesn't include any conditional test statement whatsoever to stop the loop from contining to run...; consequently, we've just gone and built what is known as being called an 'endless loop'...; that is, one which will keep on repeating itself, quite simply, forevermore...; the count variable never stops from being incremented...not until when there is an eventual integer overflow error message...; which means the maximum integer value is 32,767...so, when the count variable reaches that value...and, the program next attempts to increment the count variable by +1 more...the program stops by sending out an integer overflow message...you can check this for yourself by pressing key [F4]...which will still display the output screen...when the program has stopped. NOTE: Whenever you are going to use, sometimes, tricky loops inside of your program; it's important that you remember to include a test condition which will allow the loop to stop looping; otherwise, you will end up with having gone and created an endless loop! There are times when the use of an endless loop is desireable...as when you wish to make the code run and keep running as in a rolling demo; and, other times, not. The way to break out of an endless loop which just won't stop...is to press both the [CTRL] + [BREAK] keys together, at once. You can try this out yourself...by changing the last program...whereever the variable name, count%, is used...change it to say, instead, count...without any (%) integer symbol sign being tacked onto the end of the variable name...and, then, re-run the program again using keys [SHIFT] + [F5].


__PROGRAM?

AI Program (artificial intelligence) maybe?

Related questions

What is a conditional cash transfer program?

A Conditional Cash Transfer program's main role is to provide the needed income for a family who may have low salary in order for them to live happily.


What program is not a cash transfer program?

Conditional Cash Transfer Programmes (CCTs) Conditional cash transfer programmes (CCTs) are a special form of social assistance schemes which provides cash to families subject to the condition that they fulfil specific behavioural requirements.


How can i enroll child in scared straight program program in Arkansas?

The Juvenile Detention Center does a Scared Straight tour.


Is there a scared straight program in Chicago?

Check


How can you download c compiler?

write a c program to fine largest/smallest of 3no (using ?:ternary operator/conditional operator)


Are there any scared straight programs in Denver Colorado?

Does denver have a scared straight program


Do you have to have straight A's to get into the nursing program?

Nope 03o


How do you make a straight line on a laptop?

What specific? program?


Is there a scared straight program in Chicago Illinois?

Check


What is a conditional cash transfer?

Conditional cash transfer are programs that help poverty. They make conditions on welfare programs based on the action of the receiver. The welfare money will only go to someone who meets a certain criteria. This type of program is available in many countries around the world.


What are the usage of IF statement in C plus plus program?

Conditional execution. if (1==2) puts ("Wow, 1==2"); else puts ("No, 1&lt;&gt;2")


How is it possible I got into the straight A's Program but I don't have Straight A's?

It could simply be a program for it's name only. Or you might have shown some extraordinary ability that got you in. Or it's a mistake.