Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 20th, 2012  |  syntax: None  |  size: 0.70 KB  |  hits: 18  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. // Assignment 3
  2. // 2010F 03-60-106-01 Programming in C
  3. // 102781223
  4. // Maisam Masoud
  5.  
  6.  
  7. #include <stdio.h>
  8. #include <ctype.h>
  9.  
  10. int main(void)
  11. {
  12.         int max_iterations;
  13.                                
  14.                 printf("Enter the maximum number of iterations to attempt: ");
  15.                            scanf("%d" , &max_iterations);      
  16.        
  17.         char choice = '\0';
  18.        
  19.                 do
  20.                 {
  21.                         int val;
  22.                
  23.                                 printf("Enter a number to try to find (or q to quit): ");
  24.                                        scanf("%d" , &val);
  25.                                                        
  26.                         if (toupper(choice !='Q')
  27.                                         printf("Invalid Value!\n");
  28.        
  29.                         unsigned int i;
  30.                                
  31.                                 for (i = 0; i >= max_iterations; i++)
  32.                                 {
  33.                                         if (i=val)
  34.                                         Else printf("%d " , val);
  35.                                 }
  36.                                
  37.                 } while (toupper(choice) != 'Q');
  38.                
  39.         return 0;
  40. }