write a C program: To recognize date of any format even
formats like "feb-02-2003","02-february-2003",mm/dd/yy,
dd/mm/yy and display it as mm/dd/yy.
Answer / Khilendra Singh
```cn#include <stdio.h>nnchar month[13] = {'J','F','M','A','M','M','J','J','A','S','O','N', 'D'}; // Month namesnint days[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 30}; // Days in each month (non-leap year)nnchar date[11]; // User input datenint day = 0, monthIndex = 0;nnvoid getInput() {n scanf("%s", date);n}nnvoid setDate() {n int len = strlen(date), i;n for (i = 0; i < len - 3; i++) day += (date[i] - '0'); // Dayn for (i = 4; i < len - 1; i++) {n monthIndex = 0;n while (month[monthIndex] != date[i]) monthIndex++;n day += (30 * month[monthIndex]);n }n for (i = len - 2, monthIndex = 0; i >= 0 && monthIndex < 12; i--) {n if (date[i] != '/') continue;n while (month[monthIndex] != date[i + 1]) monthIndex++;n day += month[monthIndex];n }n printf("Date: %d/%d/ 33[92m%d 33[0m", day / 365, day % 365, date[len - 2] != '/' ? day + 1 : day);n}nnint main() {n getInput();n setDate();n return 0;n}n```
| Is This Answer Correct ? | 0 Yes | 0 No |
Write a program to print factorial of given number without using recursion?
Write a function that accepts a sentence as a parameter, and returns the same with each of its words reversed. The returned sentence should have 1 blank space between each pair of words. Demonstrate the usage of this function from a main program. Example: Parameter: “jack and jill went up a hill” Return Value: “kcaj dna llij tnew pu a llih”
write a addition of two no. program with out using printf,scanf,puts .
Explain 'bus error'?
What is structure in c explain with example?
What is the difference between functions abs() and fabs()?
#include<stdio.h> int main() { int i=0,j=1,k=2,m,n=0; m=i++&&j++&&k++||n++; printf("%d,%d,%d,%d,%d",i,j,k,m,n); }
12 Answers Capital IQ, Sasken,
What is difference between structure and union in c?
can any one please explain, how can i access hard disk(physical address)? it is possible by the use of far,near or huge pointer? if yes then please explain......
What is use of pointer?
Explain the array representation of a binary tree in C.
How we add our function in liabrary as liabrary function. Exp. we want use our int factorical(int); function as int pow(int,int); function working in math header file.