Learnem Educational
May 18, 2012, 12:39:00 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Lesson 3 first exercise  (Read 1685 times)
Bleh
Newbie
*
Posts: 4


View Profile
« on: May 15, 2002, 01:38:02 AM »

it says: Using a while loop, write a program that prints alphabets 'a' through 'z' in seperate lines. Use %c in your format string. You can increment a character type variable with ++ operand.

I don't get how to go up one letter each time in the loop. Or what it means by format string, what is the format string? If anyone can help me, reply here please or E-Mail me at xatrix_99@excite.com    Thanks.
« Last Edit: January 01, 1970, 12:00:00 AM by Bleh » Logged
Anonymous
Guest
re
« Reply #1 on: June 01, 2002, 07:56:59 AM »

int ch=97;
while (ch<=122) {
        printf("%c",ch);
        ch++;
}
« Last Edit: January 01, 1970, 12:00:00 AM by Anonymous » Logged
The Nymph
Newbie
*
Posts: 6


View Profile
« Reply #2 on: June 04, 2002, 09:50:18 AM »

The format string is the string of characters that you use to format the output on the screen. You use %c to tell the program to print out a character, %d to print out an integer, %f to print out a float, etc.
« Last Edit: January 01, 1970, 12:00:00 AM by The Nymph » Logged
Mr. Cool
Newbie
*
Posts: 11


View Profile
%
« Reply #3 on: August 16, 2002, 10:53:10 PM »

% means to format something. e.g., %d=decimal integer, %c=character, %lf=double or dbl float, %f=float with a deimal point that ends with 16 numerals, &%hd= short decimal and so on.

this is usually decifiered by yoour declaration and intialization heading. eg;

[code:g4iajmu4]
int main(void)
{
float a=3;

printf("%f", &a);
return 0;
}[/code:g4iajmu4]

good luck and if you need anything else pls ask me.
« Last Edit: January 01, 1970, 12:00:00 AM by Mr. Cool » Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!