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 |
Is it possible to type a name in command line without ant quotes?
Is it possible to print a name without using commas, double quotes,semi-colons?
main(){ unsigned int i; for(i=1;i>-2;i--) printf("c aptitude"); }
int DIM(int array[]) { return sizeof(array)/sizeof(int ); } main() { int arr[10]; printf(“The dimension of the array is %d”, DIM(arr)); }
main() { char *p = “ayqm”; char c; c = ++*p++; printf(“%c”,c); }
main() { int i=10; void pascal f(int,int,int); f(i++,i++,i++); printf(" %d",i); } void pascal f(integer :i,integer:j,integer :k) { write(i,j,k); }
how to return a multiple value from a function?
Find the largest number in a binary tree
to remove the repeated cahracter from the given caracter array. i.e.., if the input is SSAD output should of SAD
main() { int i=-1,j=-1,k=0,l=2,m; m=i++&&j++&&k++||l++; printf("%d %d %d %d %d",i,j,k,l,m); }
There are 21 people in a room. They have to form groups of 3 people each. How many combinations are possible? Write a C program to print the same.
How can you relate the function with the structure? Explain with an appropriate example.