Advertisement
derazanother

Functon 2.1

Dec 12th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. char ch;
  4.  
  5. int main(){
  6. int num,a,b,x;
  7. void display(int,char);
  8. do{
  9. printf("Enter a number (3-9): ");
  10. scanf("%d",&num);
  11.  
  12. }while (num<3 || num>9);
  13. do{
  14.  
  15. printf("Enter a Character (A-P): ");
  16. __fpurge(stdin);
  17. scanf("%c",&ch);
  18. }while (ch<'A' || ch>'P');
  19. display(num,ch);
  20.  
  21. return (0);
  22. }
  23.  
  24. void display(int x, char y){
  25. int i,j;
  26. for(i=0;i<x;i++){
  27. for(j=0;j<x;j++){
  28. printf("%c ",ch);
  29.  
  30. }
  31. printf("\n");
  32. ch++;
  33. }
  34. return;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement