#include <stdio.h>
void Test () {//1+2+3+4+.....+100
int A, B;
a=0;
b=0;
for (; a<=100; a++) {
B=b+a;
printf ("%d\n", b);
}
}
void Test1 () {//Enter a number to see if it is prime
int C;
printf ("Please enter a number greater than 10:");
scanf ("%d", &c);
printf ("In checking,wait a minuts.please\n");
if (c%2!=0&&c%3!=0&&c%5!=0&&c%7!=0)
printf ("%d is prime number \ n", c);
else printf ("%d is not prime", c);
}
/* Find Prime easier
#include <stdio.h>
#include <math.h>
int main ()
{int n,i,k;
printf ("Please enter a integer number:n=?");
scanf ("%d", &n);
K=SQR (n);
for (i=2;i<=k;i++)
if (n%i==0) break;
if (i<=k) printf ("%d is not a prime number.\n");
return 0;
}
*/
void Test2 () {//To print prime numbers within 8~100
int d=8;
while (d<100) {
if (d%2!=0&&d%3!=0&&d%5!=0&&d%7!=0)
printf ("%d is prime number \ n", d);
printf ("%d is not prime", d);
d++;
}
printf ("\ n");
}
void Test3 () {//Enter a year to see if Nadia
int e;
printf ("Please enter the year to be detected:");
scanf ("%d", &e);
printf ("in checking,wait,please...\n");
if (e%100==0) {//if
if (e%400==0)
printf ("%d year is Swiss year \ n", e);
else printf ("%d year is not Swiss year \ n", e);
}
else if (e%4==0)
printf ("%d year is Swiss year \ n", e);
else printf ("%d year is not Swiss year \ n", e);
}
void Test4 () {//Enter a letter at random to determine whether the letter is uppercase or lowercase and outputs the corresponding uppercase or lowercase letters
Char F;
printf ("Please enter a letter \ n");
F=getchar ();
scanf ("%c", &f);
printf ("wait\n");
while (f!= ' \ n ') {
if (f>= ' a ' &&f<= ' Z ') {
printf ("%c is a lowercase letter \ n", f);
printf ("The capital letter of%c is%c\n", f,f-32);
}
if (f>= ' A ' &&f<= ' Z ') {
printf ("%c is capital letter \ n", f);
printf ("The lowercase letter of%c is%c\n", f,f+32);
}
}
}
/* Uppercase and lowercase
printf ("%d-%d-%d-%d", ' a ', ' Z ', ' a ', ' Z ');//output corresponding ASIC code
if (a>=97&&a<=122) {
printf ("TA is a lowercase letter, corresponding to uppercase:%c", a-32)
}
else If ...
*/
void Test5 () {//Login system
int g,h,i,j;
I=1;
J=1;
printf ("Please enter user name:");
scanf ("%d", &g);
printf ("Please enter password:");
scanf ("%d", &h);
if (G==I&&H==J)
printf ("dengluchenggong\n");
else printf ("denglushibai\n");
}
/* Login program and can run repeatedly.
int name=0,pass=0;
int c_name=123,c_pass=456;
while (1) {
printf ("qingshuruyonghuming:\n");
scanf ("%d", &name);
printf ("qingshurumima:\n");
scanf ("%d", &pass);
if (! ( Name==c_name&&pass==c_pass)) {
printf ("Incorrect input information \ n");
}
Else{break;}
}printf ("Landing success");
*/
int main (int argc, const char * argv[]) {
Insert code here ...
printf ("Hello, world!\n");
Test ();
Test1 ();
Test2 ();
Test3 ();
Test4 ();//can run independently
Test5 ();
return 0;
}
C language 1-100 Plus, for Prime, count the Swiss-year detection letter case, login system