From baf0f3a63a31efaf6d51dff50eaa0dca05461913 Mon Sep 17 00:00:00 2001 From: 2RAJARYAN Date: Sat, 25 Nov 2023 22:37:46 +0530 Subject: [PATCH] first contri --- digitalno.c | 134 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 digitalno.c diff --git a/digitalno.c b/digitalno.c new file mode 100644 index 0000000..36da38b --- /dev/null +++ b/digitalno.c @@ -0,0 +1,134 @@ +#include +int main (){ + int h; + printf("enter the value of clock you want to print-"); + scanf("%d",&h); + switch (h) + { +case 1: + for(int i=1;i<=7;i++){ + for(int j=1;j<=4;j++) + { + if(j==4) + printf("*"); + else + printf(" "); + } + printf("\n"); + } + break; +case 2: + for(int i=1;i<=7;i++){ + for(int j=1;j<=4;j++) + { + if(i==1||i==4||j==4&&i<5||j==1&&i>=4||i==7) + printf("*"); + else + printf(" "); + } + printf("\n"); + } + break; +case 3: + for(int i=1;i<=7;i++){ + for(int j=1;j<=4;j++) + { + if(i==1||i==4||j==4||i==7) + printf("*"); + else + printf(" "); + } + printf("\n"); + } + break; +case 4: + for(int i=1;i<=7;i++){ + for(int j=1;j<=4;j++) + { + if(i==4||j==4||j==1&&i<=4) + printf("*"); + else + printf(" "); + } + printf("\n"); + } + break; +case 5: + for(int i=1;i<=7;i++){ + for(int j=1;j<=4;j++) + { + if(i==1||i==4||j==4&&i>=4||j==1&&i<=4||i==7) + printf("*"); + else + printf(" "); + } + printf("\n"); + } + break; +case 6: + for(int i=1;i<=7;i++){ + for(int j=1;j<=4;j++) + { + if(i==1||i==4||i==7||j==1||j==4&&i>=4) + printf("*"); + else + printf(" "); + } + printf("\n"); + } + break; +case 7: + for(int i=1;i<=7;i++){ + for(int j=1;j<=4;j++) + { + if(i==1||j==4) + printf("*"); + else + printf(" "); + } + printf("\n"); + } + break; +case 8: + for(int i=1;i<=7;i++){ + for(int j=1;j<=4;j++) + { + if(i==1||i==4||i==7||j==1||j==4) + printf("*"); + else + printf(" "); + } + printf("\n"); + } + break; +case 9: + for(int i=1;i<=7;i++){ + for(int j=1;j<=4;j++) + { + if(i==1||i==4||i==7||j==1&&i<=4||j==4) + printf("*"); + else + printf(" "); + } + printf("\n"); + } + break; + +case 0: + for(int i=1;i<=7;i++){ + for(int j=1;j<=4;j++) + { + if(i==1||i==7||j==1||j==4) + printf("*"); + else + printf(" "); + } + printf("\n"); + } + break; + + default: printf("enter the value from 0 to 9 only"); + break; + } +return 0; +} \ No newline at end of file