diff --git a/*triangle.c b/*triangle.c new file mode 100644 index 0000000..e203577 --- /dev/null +++ b/*triangle.c @@ -0,0 +1,19 @@ +#include +main () +{ int i,j,k; + for(j=1;j<=5;j++) + { + for(i=1;i<=5;i++) + { + if(j>=i) + { + for(k=1;k<=5;k++) + { + if(i<=k) + printf("*"); + } + printf("\n"); + } + } + } +} diff --git a/countingpyramid.c b/countingpyramid.c new file mode 100644 index 0000000..d20f08a --- /dev/null +++ b/countingpyramid.c @@ -0,0 +1,13 @@ +#include +main() +{ + int i,j; + for(i=1;i<=5;i++) + { + for(j=1;j<=5;j++) + { if(i>=j) + printf("%d",i+j-1); + } + printf("\n"); + } +} diff --git a/pyramid.c b/pyramid.c new file mode 100644 index 0000000..c851fcc --- /dev/null +++ b/pyramid.c @@ -0,0 +1,18 @@ +#include +main() +{ + int i,j; + for(i=1;i<=4;i++) + { + for(j=1;j<=4;j++) + { + if(i>j) + { + printf(" "); + } + else + printf("*"); + } + printf("\n"); + } +} \ No newline at end of file diff --git a/stick game.c b/stick game.c new file mode 100644 index 0000000..2489cb5 --- /dev/null +++ b/stick game.c @@ -0,0 +1,29 @@ +#include +int main (){ + int i,j,k,l; + char c; + printf("Hello there. Welcome. Suppose there are 11 sticks in front of you.You have to pick any number of stics from 1 to 4 (both 1 and 4 included) from 11 stics.Then allow computer to take his chance and choose any number of stics from 1 to 4.The player whose turn comes when 1 stick remains looses or the player who pics the last stick looses...so player how many sticks you chhose\n"); + scanf ("%d",&i); + if(i>=5 || i<=0){ + printf("invalid choice"); + } + else + { + printf ("\nthe number of stick you choose=%d \nsticks remaining =%d\n the computer choose %d\nsticks remaining after first round=%d.\n ...your turn again user ",i,11-i,5-i,6); + + scanf ("%d",&k); + if(k>=5 || k<=0){ + printf("invalid choice"); + } + else + { + printf("\nthe number of stick you choose=%d \nsticks remaining =%d\n the computer choose %d\nsticks remaining after round=%d..YOu LOOSE\n ",k,6-k,5-k,1); + } + + } + + + + +return 0; +} \ No newline at end of file diff --git a/trial.c b/trial.c new file mode 100644 index 0000000..1687035 --- /dev/null +++ b/trial.c @@ -0,0 +1,15 @@ +#include +main() +{ + int a; +int msg(); + +} + + +int msg() + +{ printf("i m a fool"); + return(0); + main(); +} \ No newline at end of file