C Program: Determine the Quadrant of point(x,y) by using AND Operator and else-if Statement

Quadrants

Function of scanf():
  • scanf() is the Input Statement.  
  • scanf() statement is used to give Input at the run time. 
  • Format: scanf(" %f " , &a);
  • In the above format 'a' is variable and value of 'a' is assigned at the run time. 
  • In scanf() statement, character 'f ' indicates the format i.e ("  ");
Statement of C program: Enter the value of x and y and determine the quadrant of point(x,y) :


#include<stdio.h>
#include<conio.h>

void main()
{
float x,y ;
clrscr();
printf("Enter the value of x and y\n ");              //  \n  used for next line character.
scanf(" x=%f  y=%f" , &x , &y);                           

if (x>0 && y>0)                     // Both conditions must be True in order to execute the statement.
{
printf(" point(%f,%f) lies in Ist quad\n ,x,y");
}
else if (x<0 && y>0)
{
printf(" point(%f,%f) lies in IInd quad\n , x,y");
}
else if (x<0 && y<0)
{
printf(" point(%f,%f) lies in IIIrd quad\n ,x,y");
}
else if (x>0 && y<0)
{
printf(" point(%f,%f) lies in IVth quad\n , x,y");
}
else( x==0 && y==0)
{
printf("point(%f,%f) lies at the origin\n" ,x,y);
}
getch();
}

Output1:
Enter the value of x and y
x=2   y=5                          // As both conditions i.e ( x>0 and y>0) are True so statement is executed
point(2,5) lies in Ist quad 



Output2:
Enter the value of x and y
x=2   y=-6                         // As both conditions i.e ( x>0 and y<0) are True so statement is executed
point(2,-6) lies in IVth quad 
 


Output3:
Enter the value of x and y
x=0   y=0                          // As both conditions i.e ( x=0 and y=0) are True so statement is executed
point(0,0) lies at the origin 
 


2 Responses to "C Program: Determine the Quadrant of point(x,y) by using AND Operator and else-if Statement"

  1. Haloo pak^^

    Kami dari SENTANAPOKER ingin menawarkan pak^^

    Untuk saat ini kami menerima Deposit Melalui Pulsa ya pak.

    *untuk minimal deposit 10ribu
    *untuk minimal Withdraw 25ribu

    *untuk deposit pulsa kami menerima provider
    -XL
    -Telkomsel


    untuk bonus yang kami miliki kami memiliki
    *bonus cashback 0,5%
    *bunus refferal 20%
    *bonus gebiar bulanan (N-max,samsung Note 10+,Iphone xr 64G,camera go pro 7hero,Apple airpods 2 ,dan freechips)

    Daftar Langsung Di:

    SENTANAPOKER

    Kontak Kami;

    WA : +855 9647 76509
    Line : SentanaPoker
    Wechat : SentanaPokerLivechat Sentanapoker

    Proses deposit dan withdraw tercepat bisa anda rasakan jika bermain di Sentanapoker. So… ? tunggu apa lagi ? Mari bergabung dengan kami. Pelayanan CS yang ramah dan Proffesional dan pastinya sangat aman juga bisa anda dapatkan di Sentanapoker.

    ReplyDelete
  2. Howdy, I do think your blog could be having web browser compatibility issues. When I look at your site in Safari, it looks fine but when opening in IE, it has some overlapping issues. I merely wanted to give you a quick heads up! Aside from that, excellent blog! Jio Lottery Winner 2020

    ReplyDelete

Popular Posts

Label

1 Sidebar 2 Columns 3 Columns Footer 3rdball 4 Columns Footer Alex Alvaro Antsasia Arlinadesign Averie Barry BASIC CONCEPTS Basil Bayna Fast BeautyPress BeautyTemplates Beckel Best Best - Clean Beyonce Pro BioMag BlackMag Blanter Nova Blogger Card Bloggertheme9 Blogish Bpress Brakt C LANGUAGE C PROGRAMS C++ LANGUAGE C++ PROGRAMS Carella Cellar Charlotte Chooko Lite Clara Clean Combo One Cooperate Crusade Darry Dorman Dreamway Dunia Blanter eCars EduAcademy EducationPress Elise Elvan Eva Everyday FabNews Fashion Fashion Blogger Template Fashion Gossip FastCars Fedo FlashNews Fredy Portfolio Gaming Globus GoodTime Goomsite HTML LANGUAGE iGaming Indicate Innove Insomnia InspiredNews iSoft Jasmine Kalem Landscaping Lashira Lavelle Lily Fashion Limax Linea Lionex Luminescence Lite Lumix Luxury Magazine MagazinePro MAJOR DIFFERENCES MarketingBlog Martin MaxiMag Medica Mega Melissa Mercury MeshMag Minimag Minimalist MiniNews MovieKhor msdesignbd MusicLand Neko NetZine New Spread News16 Newsflash NewsForce NewsIdea Newspaper News NewsPro Nubie Fast Odd Themes Optima PaperMag PaperMag blog Parhlo Perfection Personal Personal Blog Photosout PixelZ Power Blog Premium Themes ProfileMag Purez Rano ReadNews Real estate Remito Grid Responsive Revo Robusta Rotario Saara SeoBoost Settle Shouters Simple Catch SimpleClean Sketchly SNews SolidMag Someo Sophie Sora Sora Bank Sora Home Sora News Responsive Sora One Sora Ribbon Spido Sticko Stucco Sure Mag Swift Tech Tech Pro Techia Techmax TechSpot TemplateClue Templateism Templatesilk Templatesyard Templatezy The Freelancer TheBlogger TheFocus Themeforest Themexpose TIPS AND TRICKS Topside TravelMag Trendy Trendy Travel Tumblr Under Construction Uong Jowo Veethemes Vertox VideoPlay Vigo Waverly way2themes WebBiz Wedding X-Mag Zealer ZetaMag