C Language Learning selection structure programming (third day)

Source: Internet
Author: User

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M02/9D/DE/wKiom1mH62GxJqLyAABboBpje-o366.png-wh_500x0-wm_ 3-wmp_4-s_3678786343.png "title=" 2017-08-07_11-50-49.png "alt=" Wkiom1mh62gxjqlyaabbobpje-o366.png-wh_50 "/>

To increase understanding, write a few small programs

1: Judging the formation of the triangle and the output of the maximum side practice the first three statements

#include <stdio.h>int main () {int a,b,c;printf ("Enter the triangle three sides long (the edge is an integer, cannot enter a negative number):"); scanf ("%d%d%d", &a, &b,& c) if ((a+b) >c&& (a+c) >b&& (b+c) >a) {printf ("can form a triangle \ n"); if ((a>b&&a>c) | | ((a=b) >c)) printf ("%d\n", a); Else{if (b>a&&b>c) | | ((b=c) >a)) printf ("%d\n", b); elseprintf ("%d\n", c); }}elseprintf ("Cannot form a triangle"); GetChar ();

}

2: Judge the output after the exercise of the two statements

#include <stdio.h>int main () {char a;printf ("Please enter your score level: \ n"), scanf ("%c", &a); switch (a) {case ' a ': printf ("Good" ); Break;case ' B ': printf ("good"); Break;case ' C ': printf ("Pass"); break;default:printf ("Incorrect input"); }}


This article from "Big Plum" blog, reproduced please contact the author!

C Language Learning selection structure programming (third day)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.