/* * @(#) smt1_7.c - Program for calculation of the hitting factor of * some bombs, variant 3 (Task 1_7 at the Special Military Training course). * (c) 1996 Ivan Maidanski http://ivmai.chat.ru * Freeware program source. All rights reserved. ** * Language: ANSI C * Tested with: Borland C++ v3.1 * Last modified: 1996-12-06 18:00:00 GMT+03:00 */ #include float p[100]; int main() { int m,k,i,j,cnt,test; float s,w; printf("Input M:\n"); scanf("%d",&m); printf("Input K:\n"); scanf("%d",&k); for (i=0;i=0;j--) { s=1.0; cnt=0; test=j; for (i=0;i>=1); if (cnt==k) w+=s; } printf("\n W=%f\n\n",w); return 0; }