Divisibility

Problem

You are provided an array A  of size N  that contains non-negative integers. Your task is to determine whether the number that is formed by selecting the last digit of all the N numbers is divisible by 10 .


C Solution:

  1. #include <stdio.h>
  2. int main(){
  3. int N = 0;
  4. char* ans="No";
  5. scanf("%d", &N);
  6. long data[N];
  7. for(auto i=0; i<N; i++)
  8.     scanf("%ld", &data[i]);
  9.     // write your code here
  10. for(int i=0;i<N;i++){
  11. if(data[i]%10==0)
  12. ans="Yes";
  13. else
  14. ans="No";
  15. }
  16.     // ans = 
  17.     printf("%s", ans);
  18.     
  19.     return 0;
  20. }
Note:
       We Are Providing Every Content in this Blog Inspired From Many People and Provide it Open To All People Who Are Willing Gain Some Stuff in Computer Science.

Comment below👇 for Any Errors & Doubts.