From a09500f5c29099dda4add1015e83324be46dd178 Mon Sep 17 00:00:00 2001 From: animeshprasad15 <56110479+animeshprasad15@users.noreply.github.com> Date: Sun, 13 Oct 2019 23:02:07 +0530 Subject: [PATCH] modified some programs --- Hold_My_Beer_Too_But_Dare_Not_Drink_It.txt | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/Hold_My_Beer_Too_But_Dare_Not_Drink_It.txt b/Hold_My_Beer_Too_But_Dare_Not_Drink_It.txt index 5ea30c4..a32ec68 100644 --- a/Hold_My_Beer_Too_But_Dare_Not_Drink_It.txt +++ b/Hold_My_Beer_Too_But_Dare_Not_Drink_It.txt @@ -1,5 +1,5 @@ -------------------------------------------------------------------- -Q1. Convert a given number of days into months and days. +Q1. Convert a given number of days into months and remaining days. -------------------------------------------------------------------- #include @@ -40,9 +40,7 @@ int main() printf("Enter a & B: "); scanf("%d %d", &a, &b); printf("Before swap a=%d b=%d",a,b); - a=a+b; - b=a-b; - a=a-b; + a^=b^=a; printf("\nAfter swap a=%d b=%d",a,b); return 0; } @@ -85,14 +83,13 @@ Q17. Generate the following Pyramid Pattern: int main() { int c=97, i, j; - for(i=1;i<=4;i++) + for(i=0;i<4;i++) { - for(j=1;j<=i;j++) + for(j=0;j<=i;j++) { - printf("%c", (char)c); - c++; + printf("%c", c+j); + } - c=97; printf("\n"); } return 0;