diff --git a/HackerRank Problems/C programs/PointersInC.c b/HackerRank Problems/C programs/PointersInC.c new file mode 100644 index 0000000..5882152 --- /dev/null +++ b/HackerRank Problems/C programs/PointersInC.c @@ -0,0 +1,20 @@ +#include + +void update(int *a,int *b) { + int x, y; + x = *a + *b; + y = *a - *b; + *a = x; + *b = abs(y); +} + +int main() { + int a, b; + int *pa = &a, *pb = &b; + + scanf("%d %d", &a, &b); + update(pa, pb); + printf("%d\n%d", a, b); + + return 0; +} diff --git a/HackerRank Problems/C programs/PrintingPatternUsingLoops.c b/HackerRank Problems/C programs/PrintingPatternUsingLoops.c new file mode 100644 index 0000000..7c5e480 --- /dev/null +++ b/HackerRank Problems/C programs/PrintingPatternUsingLoops.c @@ -0,0 +1,25 @@ +#include +#include +#include +#include + +int main() +{ + + int n; + scanf("%d", &n); + // Complete the code to print the pattern. + + int len = n*2 - 1; + for(int i=0;i