iOS next day {function}

Source: Internet
Author: User
<span id="Label3"></p><p>//<br>Main.m<br>day3-1.6 work: Project knocked 4 times<br>/* job: time limit code 3 minutes<br>Prompts the user to enter an integer (within 100) from the Keyboard. If the number entered is not a multiple of 7 and does not contain 7 (bits and 10 digits do not contain 7). Output this number;<br>Otherwise the output is "over".<br><br>*/<br><br>//<br>First Question:<br>/* Enter an integer to determine the parity, and output "xxx is odd" or "xxx<br>is even ". */<br>#import <Foundation/Foundation.h><br>//<br>int main (int argc, const char * Argv[]) {<br>//<br>int a = 0;<br>printf ("please Enter an integer:");<br>scanf ("%d", &a);<br>If (a% 2 = = 0) {<br>printf ("%d is even", a);<br>//    }<br>else {<br>printf ("%d is odd", a);<br>//    }<br>//<br>//<br>Return 0;<br>//}<br><br>The second question:<br>/*<br>Enter a number to judge the Symbol. If it is greater than 0, the output is "positive";<br>At 0, the output is "negative" and if it equals 0, output "0".<br> <br>*/<br><br>#import <Foundation/Foundation.h><br>//<br>int main (int argc, const char * Argv[]) {<br>int a = 0;<br>printf ("please Enter a number:");<br>scanf ("%d", &a);<br>If (a > 0) {<br>printf ("positive number \ n");<br>}else if (a < 0) {<br>printf ("negative number \ n");<br>}else if (a = = 0) {<br>printf ("0\n");<br>//    }<br>Return 0;}<br><br><br>Question Three:<br>/*<br>Programming to determine the age of 3 people who are the oldest and print the largest<br><br>*/<br><br>#import <Foundation/Foundation.h><br>//<br>int main (int argc, const char * Argv[]) {<br>int a = 0,b = 0,c = 0;<br>printf ("please Enter the age of three persons: \ n");<br>scanf ("%d%d%d", &a,&b,&c);<br>If (a > B) {<br>If (a > C) {<br>printf ("age of the largest person:%d\n", a);<br>//        }<br>}else if (b > C) {<br>If (b > A) {<br>printf ("max age:%d\n", b);<br>//        }<br>//<br>//<br>}else<br>//    {<br>printf ("max age:%d\n", c);<br>//<br>//    }<br>//<br>//<br>//<br>Return 0;<br>//}<br><br><br>Question Fourth:<br>/*<br>Railway checked baggage regulations: baggage weighing no more than 50 kg, the consignment fee according to 0.15<br>RMB per kilogram, If more than 50 kg, excess of 0.1 per kilogram<br>Yuan. Programming to achieve the above functions.<br><br>*/<br><br>#import <Foundation/Foundation.h><br>//<br>int main (int argc, const char * Argv[]) {<br>//<br>float a = 0,b = 0;<br>printf ("please enter baggage weight: \ n");<br>scanf ("%f", &a);<br>If (a <= 50) {<br>b = a*0.15;<br>printf ("freight is:%.2f\n", b);<br>}else {<br>//<br>b = (a-50) *0.16+50*0.15;<br>printf ("freight is:%.2f\n", b);<br>//<br>//    }<br>//<br>//<br>Return 0;<br>//}<br><br>Question Fifth:<br>/*<br>There is a function: when x<1, y = x;1<=x<10, y=2x-1;<br>x>=10 time, y=3x-11. Write a program, enter x, and output y Value.<br><br>*/<br><br>#import <Foundation/Foundation.h><br>//<br>int main (int argc, const char * Argv[]) {<br>//<br>int x = 0,y = 0;<br>printf ("please Enter x:");<br>scanf ("%d", &x);<br>If (x < 1) {<br>y = x;<br>printf ("y =%d\n", y);<br>}else if (1 <=x && x < 10) {<br>y = 2*x-1;<br>printf ("y =%d\n", y);<br>//<br>}else if (x >= 10) {<br>//<br>y = 3*x-11;<br>printf ("y =%d\n", y);<br>//<br>//    }<br>//<br>Return 0;<br>//}<br><br><br>Question Sixth<br>/*<br>Write a program that completes two number Arithmetic. Such as: user input 34+56<br>The result of the output is 90.00, which requires that the result of the operation retain 2 valid decimals, the user<br>Input 2 operands and operators, based on operator results<br><br>*/<br>#import <Foundation/Foundation.h><br>//<br>int main (int argc, const char * Argv[]) {<br>//<br>float a =0,b = 0,d = 0;<br>char C = 0;<br>printf ("please Enter an expression:");<br>scanf ("%f%c%f", &a,&c,&b);<br>if (c = = ' + ') {<br>D = A + b;<br>printf ("%.2f", d);<br>}else if (c = = '-') {<br>D = a-b;<br>printf ("%.2f", d);<br>}else if (c = = ' * ') {<br>D = A * b;<br>printf ("%.2f", d);<br>}else if (c = = '/') {<br>D = a/b;<br>printf ("%.2f", d);<br>//    }<br>//<br>Return 0;<br>//}<br><br>Question Seventh: Enter 3 numbers to determine if a triangle can be formed.<br>#import <Foundation/Foundation.h><br>//<br>int main (int argc, const char * Argv[]) {<br>int a = 0,b = 0,c = 0;<br>printf ("please Enter three numbers:");<br>scanf ("%d%d%d", &a,&b,&c);<br>If ((a+b) >c&& (a+c) >b&& (b+c) >a&& (a-b) <c&& (a-c) <b&& (b-c) <a) {<br>printf ("can form a triangle");<br>//<br>}else {<br>printf ("cannot form a triangle");<br>//    }<br>//<br>//<br>//<br>Return 0;<br>//}<br><br>Question Eighth<br><br>/*<br>Enter three numbers to print the median (the second largest value) in two ways<br>Tip: first, the largest and smallest, and the second, using only comparison Operators.<br><br>*/<br>#import <Foundation/Foundation.h><br>//<br>int main (int argc, const char * Argv[]) {<br>int a = 0,b = 0,c = 0;<br>printf ("please Enter three numbers:");<br>scanf ("%d%d%d", &a,&b,&c);<br>//<br>If ((a>b && B>c) | | (c>b&&b>a)) {<br>printf ("middle value =%d", b);<br>//      }<br>else if ((a>c&&c>b) | | | (b>c&&c>a)) {<br>printf ("middle value =%d", c);<br>//<br>}else If ((b>a&&a>c) | | (c>a&&a>b))<br>//    {<br>printf ("middle value =%d", a);<br>//    }<br>else if (a==b) {<br>printf ("middle value =%d", c);<br>}else if (a==c) {<br>printf ("middle value =%d", b);<br>}else if (b==c) {<br>printf ("middle value =%d", a);<br>////    }<br>Return 0;<br>//}<br><br><br>Comparison operators<br>#import <Foundation/Foundation.h><br>//<br>int main (int argc, const char * Argv[]) {<br>//<br>int a = 0,b = 0,c = 0;<br>printf ("please Enter three numbers:");<br>scanf ("%d%d%d", &a,&b,&c);<br>int min = (a>b?b:a) >c?c: (a>b?b:a);<br>int max = (a>b?a:b) >c? (a>b?a:b): c;<br>int mid = a+b+c-min-max;<br>printf ("middle value =%d\n", mid);<br>Return 0;<br>//}<br><br>/*<br>Time limit code 3 minutes<br>Prompts the user to enter an integer (within 100) from the Keyboard. If the number entered is not a multiple of 7 and does not contain 7 (bits and 10 digits do not contain 7). Output this number;<br>Otherwise the output is "over".<br>*/<br>#import <Foundation/Foundation.h><br>int main (int argc, const char * Argv[]) {<br>int a = 0;<br>printf ("please Enter an integer within 100: \ n");<br>scanf ("%d", &a);<br>If (a%7!=0&&a/10!=7&&a%10!=7) {<br>printf ("this number =%d\n", a);<br>}else{<br>printf ("over \ n");<br>}<br><br>Return 0;<br><br>}<br><br><br><br><br><br><br><br><br><br><br><br><br><br></p><p><p>iOS next day {function}</p></p></span>
Related Article

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.