From 7270c346a5ca76e5fb8cf8784bddf803aea5464c Mon Sep 17 00:00:00 2001 From: ajayraj004 Date: Wed, 24 Jan 2024 02:14:53 +0530 Subject: [PATCH] Add: Pattern Question --- Ajay.c | 156 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 Ajay.c diff --git a/Ajay.c b/Ajay.c new file mode 100644 index 0000000..8d7c668 --- /dev/null +++ b/Ajay.c @@ -0,0 +1,156 @@ +//Question 1 +// #include +// int main() +// { +// int n,i,sum=0; +// printf("Enter a number:"); +// scanf("%d",&n); +// for(i=0;i<=n;i=i+2) +// { +// sum=sum+i; +// } +// printf("The sum of even numbers till %d is : %d",n,sum); +// return 0; +// } + + + + + + + +// Question 2 +// #include +// int main() { +// int i; +// for(i=1; i<=100; i++) { +// if(i%3==0) +// { +// printf("Fizz\n"); +// } +// else if (i%5==0) +// { +// printf("Buzz\n"); +// } +// else if(i%3==0 && i%5==0) +// { +// printf("FizzBuzz\n"); +// } +// else +// { +// printf("%d",i); +// } +// } +// return 0; +// } + + + + + + + + +//Question 3 Diamond + + +// #include + +// int main(){ +// int i,j,space,rows; + +// printf("Enter the rows :"); +// scanf("%d",&rows); + +// for(i=1; i<=rows; i++) +// { +// for(space=1; space<=rows-i; space++) +// { +// printf(" "); +// } +// for(j=1; j<=i; j++) +// { +// printf("* "); + +// } +// printf("\n"); +// } +// for(i=rows; i>=1; i--) +// { +// for(space=1; space<=rows-i; space++) +// { +// printf(" "); +// } +// for(j=1; j<=2*i-1; j++) +// { +// printf("*"); +// } +// printf("\n"); +// } + +// return 0; +// } + + + + + + + + + +//Question 4 Pattern date--> 23/01/2024 + +// #include + +// int main() +// { +// int i,j; + +// for(i=1; i<=5; i++) +// { +// for(j=1; j<=i; j++) +// { +// if((i+j)%2==0) +// { +// printf("1"); +// } +// else +// { +// printf("0"); +// } +// } +// printf("\n"); +// } + +// return 0; +// } + + + + + + + +//Question 5 Pattern date-->23/01/2024 + +// #include + +// int main() +// { +// int n,number=1; + +// printf("Enter the number of rows: "); +// scanf("%d",&n); + +// for(int i=1; i<=n; i++) +// { +// for(int j=1; j<=i; j++) +// { +// printf("%d",number); +// number++; +// } +// printf("\n"); +// } +// return 0; +// } \ No newline at end of file