Team Event
Super Quiz Bee is a famous quiz Competition that tests students on a wide variety of academic subjects. This week’s competition was a Team event and students who register for the event will be given a unique registration code N. The participants are teamed into 10 teams and the team to which a participant is assigned to depends on the absolute difference between the first and last digit in the registration code.The event organizers wanted your help in writing an automated program that will ease their job of assigning teams to the participants. If the registration number given is less than 10, then the program should display "Invalid Input".
Input Format:
The only line of input contains an integer N.
Output Format:
Output the absolute difference between the first and last digit of N.
Refer sample input and output for formatting specifications.
Sample Input 1:
345
Sample Output 1:
2
Sample Input 2:
9
Sample Output 2:
Invalid Input
Solution:
#include<stdio.h>
#include<stdlib.h>
int main()
{
int n,s,i[10],a,g;
scanf("%d",&n);
if(n/10==0)
printf("Invalid Input");
else
{
for(a=0;n!=0;a++)
{
s=n%10;
n=n/10;
i[a]=s;
}
g=abs(i[0]-i[a-1]);
printf("%d",g);
}
return(0);
}
Thanks for your information. It was looks as Awesome events.Keep doing it.
ReplyDeleteBest Event Organisers in Visakhapatnam
Birthday event organisers in vizag
Birthday Event Organisers in Visakhapatnam
Marriage Event Organisers in Visakhapatnam
your blog giving the best information about event organisers.
ReplyDeleteEvent Organisers in tirupati
Event Management Companies In tirupati
Best event management companies in tirupati
Best event organisers in tirupati
Thank you for sharing about your inforamtion. Keep update like this.
ReplyDeleteBirthday event organisers in warangal
Marriage Event Organisers in warangal
event organizers in warangal