write a c-program to display the time using FOR loop
Answers were Sorted based on User's Feedback
Answer / chaitanya
main()
{
for(;1;)
{
int hr,mt,sec;
for(hr=0;hr<24;hr++)
{
for(mt=0;mt<60;mt++)
{
for(sec=0;sec<60;sec++)
{
sleep(1000);
printf("%d:%d:%d",hr,mt,sec);
}
}
}
}
}
| Is This Answer Correct ? | 8 Yes | 8 No |
Answer / guru
sir, actually i want same program but not using for loop,
using goto statement
| Is This Answer Correct ? | 1 Yes | 2 No |
main()
{
int hr,mt,sec;
for(hr=0;hr<12;hr++)
{
for(mt=0;mt<60;mt++)
{
for(sec=0;sec<60;sec++)
{
sleep(1000);
printf("%d:%d:%d",hr,mt,sec);
}
}
}/* here sleep(1000) maintain intervel of one sec b/w two
print statements*/ if u have any doubts contact my mail-id
is: venugopal.palavalasa@gmail.com
| Is This Answer Correct ? | 7 Yes | 13 No |
void main() { if(~0 == (unsigned int)-1) printf(“You can answer this if you know how values are represented in memory”); }
pls anyone can help me to write a code to print the values in words for any value.Example:1034 to print as "one thousand and thirty four only"
main() { char p[ ]="%d\n"; p[1] = 'c'; printf(p,65); }
main() { int i=5,j=10; i=i&=j&&10; printf("%d %d",i,j); }
write a program in c to merge two array
Declare an array of N pointers to functions returning pointers to functions returning pointers to characters?
Write a c program to search an element in an array using recursion
Write a prog to accept a given string in any order and flash error if any of the character is different. For example : If abc is the input then abc, bca, cba, cab bac are acceptable, but aac or bcd are unacceptable.
Give a one-line C expression to test whether a number is a power of 2.
main() { char i=0; for(;i>=0;i++) ; printf("%d\n",i); }
Give a oneline C expression to test whether a number is a power of 2?
25 Answers EA Electronic Arts, Google, Motorola,
x=2 y=3 z=2 x++ + y++; printf("%d%d" x,y);