Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Feel free to optimize the code and send it to the Facebook page, I'll put your name on it...
- //https://www.facebook.com/AminproPastebin
- #include <stdio.h>
- int main(){
- int x;
- int y;
- int i;
- int j;
- int mode;
- char pattern;
- printf("Please enter the pattern of interest:");
- scanf("%c", &pattern);
- printf("Please enther the size of the box (Height and Width): ");
- scanf("%d%d", &x, &y);
- printf("Select filling type mode, EMP(0) or ONE(1): ");
- scanf("%d", &mode);
- for(i=0;i<y;i++){
- printf("%c", pattern);// 1st row
- }
- printf("\n");
- x = x-2;
- y = y-2;
- for(j=0;j<x;j++){
- printf("%c", pattern);
- if(mode != 1){ //start check for mode 0
- for(i=0;i<y;i++){
- printf(" ");
- }
- }//End check mode 0
- else if (mode = 1){
- for(i=0;i<y;i++){
- printf("1");
- }
- }
- printf("%c\n", pattern);
- }
- y = y +2;
- for(i=0;i<y;i++){
- printf("%c", pattern);
- }
- printf("\n");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement