Amazon.com Widgets Exercise 6.1
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 19, 2013, 05:42:19 AM
Home Help Search chat Login Register   
News: Read this please.The Great Kangaroo Escape Looking for reviews of the 4th ed on Amazon!   Twitter:  @skochan
                     

+  Official Forum for Programming in Objective-C (the iPhone Programming Language) - Stephen Kochan
|-+  Old Stuff
| |-+  Answers to Exercises
| | |-+  Chapter 6
| | | |-+  Exercise 6.1
Pages: [1]   Go Down
Print
Author Topic: Exercise 6.1  (Read 350 times)
johnyorke
Newbie
*
Posts: 18


Email




« on: January 15, 2012, 08:17:50 AM »

Code: (Objective-C)
// Exercise 6.1

#import <Foundation/Foundation.h>

int main(int argc, char *argv [])

{
int value1, value2, isDivisible;

NSLog (@"Please type in two numbers.");
scanf (" %i %i", &value1, &value2);

isDivisible = value1 % value2;

if (isDivisible > 0)
        NSLog (@"The first number IS NOT evenly divisible by the second.");

else NSLog (@"The first number IS evenly divisible by the second.");

return 0;
}
Input:
Quote
400 40
Output:
Quote
The first number IS evenly divisible by the second.
Logged
Pages: [1]   Go Up
Print
Jump to:  



Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Entire forum contents (c) 2009 classroomM.com. All rights reserved.