Using strcmp Get link Facebook X Pinterest Email Other Apps - August 20, 2020 #include<stdio.h>#include<string.h>int main(){ char st1[45] = "Hel"; char *st2 = "Helo"; int val = strcmp(st1, st2); printf("Now the val is %d", val); return 0;} Get link Facebook X Pinterest Email Other Apps Comments
bird game - August 23, 2020 #include<stdio.h> #include<conio.h> #include<dos.h> #include<time.h> int x=5,y=2,gameend =0,w1,e,upl=2,upb=50,ch = 0 ,upl2 = 2; int upb2 = 70,downl1 = 9,downb1 = 60,downb2 = 77,downl2 = 9; int upl3= 2,upb3 =35 ,downl3 =9 ,downb3 = 50,score = 0; void draw(); void move(); int main(){ while(gameend != 1) { clrscr(); draw(); move(); score++; delay(300); } clrscr(); printf("score = %d",score); getch(); return 0; } void draw() { int l,b; for (l=0;l<10;l++) { for(b=0;b<78;b++){ if (l==0||l==9||b==0){ printf("-"); } else if ( ch == 15){ ch =0; } else if(l==x&&b==y){ printf("0"); } else if(upb-1 == b&&upl-1 == l){ printf("|"); upb--; } else if(upb == b&&upl == l){ printf("|"); } else if(upb2-1 == b&&upl2-1 == l){ printf("|"); upb2--; } else if(upb2 == b&&upl2 == l){ printf("|... Read more
c program tables making - July 10, 2020 #include<stdio.h> int main (){ int num; printf("which table do you want \n>>"); scanf("%d",&num); printf(" ===%d===\n",num); for (int i =1;i<=10;i++){ printf("%d × %d = %d\n",num,i,num*i); } main(); } Read more
Find factorial - August 20, 2020 #include<stdio.h> int main(){ // factorial(4) - 1 * 2 * 3 * 4 // factorial(6) - 1 * 2 * 3 * 4 * 5 * 6 int i=0, n=7, factorial=1; for(i=1;i<=n;i++){ factorial *=i; } printf("The value of factorial %d is %d", n, factorial); return 0; } Read more
Comments
Post a Comment