All programs must be indented using emacs indentation, with two characters inden
ID: 3530612 • Letter: A
Question
All programs must be indented using emacs indentation, with two characters indentation for each indentation level. To set the indentation to two, add the following line to the .emacs file in your home directory: (setq-default c-basic-offset 2) Write a C program called box1 that takes a single command line argument n and prints a solid box of asterisks of size n. Don't do any error checking. abcd 12:00am > ./box1 5 ***** ***** ***** ***** ***** Write a C program called box2 that takes a single command line argument n and prints an empty box of asterisks and spaces of size n. This program must contain a function void printchars(char c, int n) that prints the character c n times. The main function will use this function to print the box. Don't do any error checking. abcd 12:10am > ./box2 5 ***** * * * * * * * * * * *****Explanation / Answer
#include<stdio.h>
int main(){
int n,i,j;
printf("Enter n: ");
scanf("%d",n);
for(i=0;i<n;i++){
for(j=0;j<n;j++){
printf("*");
}
printf(" ");
}
getchar();
return 0;
}