Before seeing the solution make sure that you tried enough. Don’t paste the whole code, just find out the logic. If you stuck in trouble, just inform me on comment.
/**Bismillahir Rahmanir Rahim.**/ #include <stdio.h> int main() { unsigned long long int n; while(scanf("%llu", &n)) { if(n == -1ll) break; if(n == 0ll) printf("0\n"); else printf("%llu\n", n - 1ll); } return 0; }
if(n == -1ll) break;
ReplyDeleteif(n == 0ll) printf("0\n");
please explain these line
u can try :
Delete/*
* Little Ducks.
*/
#include
int main(){
unsigned long long int p, r;
while(1){
scanf("%llu", &p);
if(p == -1) break;
else if(p == 0) printf("%llu\n", p);
//r = p - 1;
else if(p != 0) printf("%llu\n", p-1);
}
return 0;
}
?
ReplyDeleteNo need this you can try this if(n==-1) break; if(n==0)print("0\n");
ReplyDelete