Guest User

Untitled

a guest
Dec 18th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.67 KB | None | 0 0
  1. #include <stdio.h> /*standard input and output header file*/
  2.  
  3. int main()
  4. {
  5.     printSequence ();
  6.    
  7.     printf("Again?"); //display Again after the last line
  8.    
  9.     char userResponse;
  10.    
  11.     scanf("%c",  &userResponse);
  12.    
  13.     while (c == "Y") {
  14.         printSequence ();
  15.    
  16.         printf("Again?"); //display Again after the last line
  17.        
  18.         scanf("%c",  &userResponse);
  19.     }
  20.    
  21.     return 0;
  22. }
  23.  
  24. void printSequence ()
  25. {
  26.     int counter=1; /*setting the variable to start at 1*/
  27.     while(counter < 6) /*using a while loop to set the counter less than 6*/
  28.     {
  29.         printf("%d\n",counter); /*display the numbers less than 6*/
  30.         counter += 1; /*increment it by 1 anytime the number is displayed*/
  31.     }
  32. }
Add Comment
Please, Sign In to add comment