Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- /* run this program using the console pauser or add your own getch, system("pause") or input loop */
- int main(int argc, char *argv[]) {
- int N, M;
- int i, j ,probability;
- char a;
- char b;
- printf("Enter the number of rows: \n");
- scanf(" %d", &N);
- printf("Enter the number of columns: \n");
- scanf(" %d", &M);
- printf("\nEnter first character");
- scanf(" %c", &a);
- printf("\nEnter second characters");
- scanf(" %c", &b);
- while(isdigit(a) || isdigit(b))//check if sine is a digit
- {
- printf("\nEnter two characters");
- scanf(" %c %c", &a, &b);
- }
- for (i= 0; i<N; i++)
- {
- for(j=0; j<M; j++)
- {
- probability=rand()%10; //probability about 1 of 10
- if(probability==1) //probilityy = 1
- {
- printf("%c", a);
- }
- else
- {
- printf("%c", b);
- }
- }
- printf("\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement