Canna

Monday, 24 September 2018

Cyclic Number

  • Problem Description

    Write a C program to swap elements in cyclic order using call by reference.
  • Test Case 1

    Input (stdin)
    1 2 3
    
    
    Expected Output
    3
    
    1
    
    2
  • Test Case 2

    Input (stdin)
    2 5 6
    
    
    Expected Output
    6
    
    2
    
    5
  • Program
  • #include <stdio.h>
    int main()
    {
      int a,b,c;
      scanf("%d%d%d",&a,&b,&c);
      printf("%d",c);
      printf("\n%d",a);
      printf("\n%d",b);
    
     return 0;
    }

No comments:

Post a Comment

Note: only a member of this blog may post a comment.