Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- int c[100]= {0},d[100]= {0},i,j,a,b,max=0;
- char s=' ',x[4],y[4];
- for (i=0;i<1;i++)
- {scanf ("%s %s",&x,&y);}
- //{printf("%s%s",x,y);}
- printf("PLz input number of student.");
- scanf("%d %d",&a,&b);
- if (a>=b)
- {max=a;}
- else
- {
- max=b;
- }
- printf("Test room for %s and %s\n",x,y);
- for (i=1; i<=a; i++)
- {
- c[i]=i;
- }
- for (i=1; i<=b; i++)
- {
- d[i]=i;
- }
- //printf("%d",c[5]);
- printf ("\t\troom 1\n");
- printf("\t\tfrom number 01 to 25\n");
- for (i=1; i<=25; i++)
- {
- if (d[i]==0&&c[i]==0)
- {
- printf("%3c- %2c-",s,s);
- }
- else
- if (c[i]==0)
- {
- printf("%3c- %2d",s,d[i]);
- }
- else if (d[i]==0)
- {
- printf("%5d %c-",c[i],s);
- }
- else
- {
- printf("%5d %2d",c[i],d[i]);
- }
- if (i%5==0)
- {
- printf("\n");
- }
- }
- if (c[i]<26&&d[i]<26)
- return 0;
- printf("\t\troom 2\n");
- printf("\t\tfrom number 26 to %d\n",max);
- for (i=26; i<=50; i++)
- {
- if (d[i]==0&&c[i]==0)
- {
- printf("%3c- %2c-",s,s);
- }
- else if (c[i]==0)
- {
- printf("%3c- %2d",s,d[i]);
- }
- else if (d[i]==0)
- {
- printf("%5d %c-",c[i],s);
- }
- else
- {
- printf("%5d %2d",c[i],d[i]);
- }
- if (i%5==0)
- {
- printf("\n");
- }
- }
- scanf(" ");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement