Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C programming only*** Name this program shift.c – Retrieve the file shift.c from

ID: 3667143 • Letter: C

Question

C programming only***

Name this program shift.c – Retrieve the file shift.c from troll.cs.ua.edu using wget or curl. For this program, you need to write two functions, shiftLeft and shiftRight. These functions both take three integer values and then shift these values to the left (or right). This is a variation on swap. Instead of swapping two values, you shift the three values to the left (or right). The main routine has already been written for you, you simply need to write the two functions shiftLeft and shiftRight.

Explanation / Answer

#include void LeftShift(int *a,int *b,int *c); void RightShift(int *a,int *b,int *c); int main(){ int a,b,c; printf("Enter value of a, b and c respectively: "); scanf("%d%d%d",&a,&b,&c); printf("Value before Shifting: "); printf("a=%d b=%d c=%d ",a,b,c); LeftShift(&a,&b,&c); printf("Value after Left Shift: "); printf("a=%d b=%d c=%d ",a,b,c); printf("Again Enter value of a, b and c respectively: "); scanf("%d%d%d",&a,&b,&c); printf("Value before Right Shifting: "); printf("a=%d b=%d c=%d ",a,b,c); RightShift(&a,&b,&c); printf("Value after Right Shift: "); printf("a=%d b=%d c=%d ",a,b,c); return 0; } void RightShift(int *a,int *b,int *c){ int temp; temp=*b; *b=*a; *a=*c; *c=temp; } void LeftShift(int *a,int *b,int *c){ int temp; temp=*b; *c==*a; *b=*c; *a=temp; }