#include<stdio.h>
int main (void)
{
char upper[27]; // A-Z plus null terminator char lower[27]; // a-z plus null terminator char c;
int i;
for (i = 0, c = 'A'; c <= 'Z'; ++c, ++i)
{
upper[i] = c;
lower[i] = c - 'A' + 'a';
}
upper[i] = 0; // null-terminator
lower[i] = 0; // null-terminator
printf ("%s\n", upper);
printf ("%s\n", lower);
return 0;
}
write a program to print A to Z on screen in c?
I'll just write a function to do that, I hope the good people won't try to run it as it is.... void function() { char c = 'a'; if( c >= 'a' && c <='z' ) System.out.println("LowerCase"); else if( c>='A' && c <='Z' ) System.out.println("UpperCase"); else System.out.println("Special Character"); }
vowels$ = "aeiou" CLS PRINT "PROGRAM: Find if letter is a vowel or not" PRINT INPUT "Type a single alphabet letter: (a-z)/and, then, press Enter key"; aLetter$ PRINT PRINT "Letter "; aLetter$; IF INSTR(vowels$, LCASE$(aLetter$)) THEN PRINT " is a vowel." ELSE PRINT " is NOT a vowel." END
#include<iostream> int main() { using namespace std; char c='A'; do { cout<<c; }while(c++<'Z'); cout<<endl; }
N = x If y < N then N = Y If z < N then N = z Print N
Zither. It has 12 strings and you pluck them.
I'll assume the list is supplied as arguments to the program: #include <stdlib.h> #include <stdio.h> main (argc, argv) int argc; char **argv; { int c = 0, mn, mx, z; while (--argc) { z = atoi(*(++argv)); if (!c++) mx = mn = z; else if (z > mx) mx = z; else if (z < mn) mn = z; } if (c) printf("%d numbers, min = %d, max = %d\n", c, mn, mx); else printf("No arguments given: please supply a list of numbers as arguments\n"); } Any error trapping is left as an exercise.
(c - z)(c^2 + cz + z^2)
Try thisinput "z =?";x,yprint "z=";x;"+";y;"i"input "w =?";u,vprint "w=";u;"+";v;"i"print "z+w = ";x+u;"+";y+v;"i"print "z*w = ";x*u-y*v;"+";x*v+y*u;"i"example output:z=? 1,2w=? 2,3z+w = 3+5iz*w = -4+7iNote that it is possible to input negative imaginary parts. To display the sum and product correctly in that case, you need to make an intermediate step in the program which assigns the imaginary part to a separate variable, decide whether or not the imaginary part is negative, and then print a "+" if it is positive or no sign when it is negative (printing a negative number will automatically print the negative sign).Of course, you need to modify the program to your computer language.
To solve this you need to remember that chars in C are represented as ints. Because of this property, you can use int comparison operators: // to test if character c is a letter int is_alpha(const char c) { if( c >= 'a' && c <= 'z' ) return 1; if( c >= 'A' && c <= 'Z' ) return 1; return 0; } // to test if character c is a digit int is_digit(const char c) { if( c >= '0' && c <= '9' ) return 1; return 0; } To test for a "special character" you would probably do best writing a similar function which checks for other ASCII value ranges.
· Zing Went the Strings Of My Heart - Frank Sinatra
word having c and z is "crazy"