You are here:   HomeC Programming (Theory)Control Structures in CWrite a C program which to find the grace marks for a student using switch. The user should enter the class obtained by the student and the number of subjects he has failed in.
by Dinesh Thakur Category: Control Structures

 

 

#include<stdio.h>

#include<conio.h>
#include<math.h>
void main()
{
int x1,y1,x2,y2,x3,y3;
int s1,s2,s3;
clrscr();
printf("\nEnter the values of x1 and y1 coordinates of first point:");
scanf("%d%d",&x1,&y1);
printf("\nEnter the values of x2 and y2 coordinates of first point:");
scanf("%d %d",&x2,&y2);
printf("\nEnter the values of x3 and y3 coordinates of first point:");
scanf("%d%d",&x3,&y3);
sl = abs(x2- x1)/abs (y2- y1);
s2 = abs(x3- xl)/abs (y3 – y1);
if((s1 == s2) && (s1 == s3))
printf("\n\tPoints are Collier.");
else
printf("\n\tPoints are Not Collier"):
printf("\n press any key to exit.");
getch();
}
 
OUTPUT:
 
Enter the values of x 1 and y 1 coordinates of first point: 10 12
Enter the values of x2 and y2 coordinates of first point: 15 17
Enter the values of x3 and y3 coordinates of first point: 20 22
Points are Collier.
press any key to exit.
 


Subscribe To Free Daily Newsletter!

Get Free News Updates Delivered Directly To Your Inbox
About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular Computer Notes blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to contact us.



What's New and Popular





Popular Article