1 solutions

  • 0
    @ 2025-11-5 15:57:04

    C++ :

    #include<iostream>
    #include<cstring>
    #include<cstdio>
    #include<cmath>
    using namespace std;
    int main()
    {
    	int s,b,tot=0;
    	cin>>s>>b;
    	for(int i=s;i<=b;++i)
        {
        	if(i%6==0||i%8==0)
        	++tot;
        }
        cout<<tot;
        return 0;
    }
    

    Pascal :

    program y2;
     var a,b,i,j,js:integer;
     begin
      readln(a,b);
      js:=0;
      for i:=a to b do
       begin
        if (i mod 6)=0
         then js:=js+1;
        if (i mod 8)=0
         then js:=js+1;
        if (i mod 6) or (i mod 8)=0
         then js:=js-1;
       end;
      writeln(js);
     end.
    
    
    • 1

    Information

    ID
    17366
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By