0
Write program to calculate odd clock (h.m.s)from (1:00:00)to (12:59:59)
how can do this question???by using loop
7 ответов
+ 2
I tried to Google search for odd clock also no help...
+ 1
What "odd clock" actually is?
+ 1
alright , let's see if these what you need for :
for ( int hour = 0 ; hour <= 12 ; hour++ ) {
for ( int minute = 0 ; minute < 60 ; minute++ ) {
for ( int second = 0 ; second < 60 ; second++ ) {
Console.WriteLine( "Hour : " , hour , " Minute : " , minute , " Second : " , second);
//do what you want in here , let's say ODD thing you need.
if ( hour % 2 == 1 ) { } //Your ODD Hour
if ( minute % 2 == 1 ) { } //Your ODD Minute
if ( second % 2 == 1 ) { } //Your ODD Second
}
}
}
Bump these ODDness LoL.
+ 1
# include <iostream>
using namespace std;
int main()
{
for(int h=1;h<=12;h++)
for(int m=1;m<=59;m++)
for(int s=1;s<=59;s+=2)
cout<<h<<":"<<m<<":"<<s<<endl;
return 0;
}
0
just calculate odd clock from 1 to 12
0
I am solution this problem
0
but you should do cout