Amazon.com Widgets Exercise 5.5
Welcome, Guest. Please login or register.
Did you miss your activation email?
June 19, 2013, 03:17:59 PM
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 5
| | | |-+  Exercise 5.5
Pages: [1]   Go Down
Print
Author Topic: Exercise 5.5  (Read 546 times)
tuhinbhatt
Newbie
*
Posts: 3


Email




« on: May 04, 2011, 07:18:58 AM »

#import <Foundation/Foundation.h>
//User can calculate inputed Number of Triangular Numbers

int main (int argc, const char * argv[])
{
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
   
   int n,number,triangularnumber,counter,k;
   
   NSLog(@"Enter the Total Numbers you want for  the Triangular Matrix");
   scanf("%i",&k);
   
   for(counter=1;counter<=k;counter++)
   {
      NSLog(@"Enter Your Triangular Number");
      scanf("%i",&number);
      
      triangularnumber=0;
      for(n=1;n<=number;n++)
      
         triangularnumber=triangularnumber+n;
         NSLog(@"Triangular Number of %i is %i",number,triangularnumber);
   
      
   }
   [pool drain];
   return 0;

}
« Last Edit: May 04, 2011, 07:21:12 AM by tuhinbhatt » 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.