Skip to content

Commit 993533e

Browse files
authoredJul 28, 2022
Add files via upload
1 parent 91011c9 commit 993533e

File tree

8 files changed

+613
-49
lines changed

8 files changed

+613
-49
lines changed
 

‎1.c

+9-24
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,12 @@
1+
#include<stdio.h>
12

2-
#include <stdio.h>
3-
#include<string.h>
4-
#include<stdlib.h>
5-
int main()
6-
{
7-
char Str[]="123456789";
8-
int i,j,k,l;
9-
for(i=0;i<5;i++)
3+
int main(){
4+
int n,ans=1 ;
5+
printf("Enter Number :");
6+
scanf("%i",&n);
7+
for(int i=1;i<=10;i++)
108
{
11-
for(k=4;k>i;k--)
12-
{
13-
printf(" ");
14-
}
15-
for(j=0,l=i;j<=i;j++,l++)
16-
{
17-
printf("%c", Str[l]);
18-
}
19-
l=l-2;
20-
for(k=0; k<i;k++,l--)
21-
{
22-
printf("%c",Str[l]);
23-
printf("\n");
24-
25-
}
9+
ans=n*i;
10+
printf("\n %i x %i = %i",n,i,ans);
2611
}
27-
}
12+
}

‎17_6.c

+445
Large diffs are not rendered by default.

‎2.c

+21-25
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,22 @@
1-
#include <stdio.h>
2-
int main() {
3-
int i, space, rows, k = 0, count = 0, count1 = 0;
4-
printf("Enter the number of rows: ");
5-
scanf("%d", &rows);
6-
for (i = 1; i <= rows; ++i) {
7-
for (space = 1; space <= rows - i; ++space) {
8-
printf(" ");
9-
++count;
10-
}
11-
while (k != 2 * i - 1) {
12-
if (count <= rows - 1) {
13-
printf("%d ", i + k);
14-
++count;
15-
}
16-
else {
17-
++count1;
18-
printf("%d ", (i + k - 2 * count1));
19-
}
20-
++k;
21-
}
22-
count1 = count = k = 0;
23-
printf("\n");
24-
}
25-
}
1+
#include<stdio.h>
2+
263

4+
int main(){
5+
int a,b,c;
6+
printf("Enter 1st side of trinagle:");
7+
scanf("%i",&a);
8+
printf("Enter 2nd side of trinagle:");
9+
scanf("%i",&b);
10+
printf("Enter 3rd side of trinagle:");
11+
scanf("%i",&c);
12+
if(a==b && b==c)
13+
{
14+
printf("Triangle with sides %i %i %i is Equilateral triangle",a,b,c);
15+
}
16+
else if (a==b || b==c || a==c)
17+
{
18+
printf("Triangle with sides %i %i %i is Isosceles triangle",a,b,c);
19+
}
20+
else
21+
printf("Triangle with sides %i %i %i is Scalence triangle",a,b,c);
22+
}

‎3.c

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include<stdio.h>
2+
int main(){
3+
int sum=0;
4+
for(int i=1;i<=100;i++)
5+
{
6+
sum=sum+i;
7+
}
8+
printf("Sum of natural number till 100 is %i",sum);
9+
}

‎4.c

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#include<stdio.h>
2+
#include<math.h>
3+
int main(){
4+
int n,sum=0;
5+
printf("Enter N:");
6+
scanf("%i",&n);
7+
for(int i=1;i<=n;i++)
8+
{
9+
sum=sum+(pow(i,2));
10+
}
11+
printf("Sum of natural number till %i is %i in Series: 1^2+2^2+3^2+4^2+..N^2 ",n,sum);
12+
}

‎4_6_22_mnc.c

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
// TASK-1 Your company deals with orders from clients on a regular basis.
2+
// To ensure that client is valid to place an order, they must be of age>18
3+
// and they must have a registered account with your company.
4+
// Write a code to input the client’s age and username,
5+
// If the username is “admin” then the client is registered with your company.
6+
// Otherwise, if they are of age>18 but not with a registered account,
7+
// show a message informing it and ask them to input a new username and password and print it.
8+
9+
#include<stdio.h>
10+
#include<string.h>
11+
#include<stdlib.h>
12+
13+
14+
int main(){
15+
int age;
16+
float bill;
17+
int p_id,quantity,total;
18+
char username[10],order[20],password[15];
19+
printf("******Welcome to XYZ_MNC*******\n");
20+
printf("\nEnter you Username:");
21+
fflush(stdin);
22+
gets(username);
23+
printf("\nEnter you age:");
24+
scanf("%i",&age);
25+
if((strcmp(username,"admin")==0) && age>18)
26+
{
27+
system("clear");
28+
printf("\n*********** You're Successfully Logined!! *************");
29+
printf("\nHere are list of Products\n1.USB-Dock(P-ID:1):-₹349\n2.Mouse(P-ID:2):-₹239\n3.Hard-disk(P-ID:3):-₹699\n4.Laptop-Case(P-ID:4):-₹500\n5.Trackpad(P-ID:5):-₹550\n");
30+
printf("\nEnter Product ID(P-ID) you want to buy:");
31+
scanf("%i",&p_id);
32+
printf("Enter Quantity:");
33+
scanf("%i",&quantity);
34+
if(p_id == 1)
35+
{
36+
total=349*quantity;
37+
}
38+
else if(p_id == 2)
39+
{
40+
total=239*quantity;
41+
}
42+
else if(p_id == 3)
43+
{
44+
total=699*quantity;
45+
}
46+
else if(p_id == 4)
47+
{
48+
total=500*quantity;
49+
}
50+
else if(p_id == 5)
51+
{
52+
total=550*quantity;
53+
}
54+
bill=total*1.05;
55+
system("clear");
56+
printf("you bill before discount is %.2f",bill);
57+
if (bill>0 && bill<1000)
58+
bill=0.98*bill;
59+
else if(bill<2000 && bill>1000)
60+
bill=0.95*bill;
61+
else if(bill<3000 && bill>2000)
62+
bill=0.9*bill;
63+
printf("\nYour Total after Discount is %.2f including GST\n\n",bill);
64+
65+
66+
}
67+
else
68+
{
69+
if((strcmp(username,"admin")!=0) && age>18)
70+
{
71+
printf("\nSorry you are not Registered user.Please Register");
72+
printf("\nEnter Username you want to Register:");
73+
fflush(stdin);
74+
gets(username);
75+
printf("\nEnter Password:");
76+
gets(password);
77+
printf("\nCongrulations!! You've Sucessfully Created account with Username:%s and Password:%s",username,password);
78+
}
79+
else
80+
printf("Invalid User");
81+
}
82+
}

‎5.c

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#include<stdio.h>
2+
int main(){
3+
int n,cube=1;
4+
printf("Enter Number of Terms:");
5+
scanf("%i",&n);
6+
for(int i=1;i<=n;i++)
7+
{
8+
cube=i*i*i;
9+
printf("\nNumber is : %i and cube of the %i is :%i",i,i,cube);
10+
}
11+
}

‎main.c

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#include"evm.h"
2+
3+
4+
int main(){
5+
char password[25];
6+
printf("*********Welcome to EVM*********");
7+
printf("\nHello, Priyank");
8+
for(int j=3;j>0;j--)
9+
{
10+
printf("\nEnter Password(you've %i attempt):",j);
11+
scanf("%s",password);
12+
if(strcmp(password,"priyank1282") == 0)
13+
{
14+
voting();
15+
break;
16+
}
17+
else
18+
{
19+
printf("Wrong Password!! Try Again..\n");
20+
continue;
21+
}
22+
}
23+
printf("\n");
24+
}

0 commit comments

Comments
 (0)
Please sign in to comment.