Skip to content

Instantly share code, notes, and snippets.

@saiedabbas93
saiedabbas93 / STONE_PAPER_SCISSORS_WITH_COMPUTER.c
Created August 13, 2019 22:31
STONE PAPER SCISSORS WITH THE COMPUTER
#include<stdio.h>
#include<conio.h>
#include<time.h>
#include<stdlib.h>
void main()
{
char player1[10];
int in1,in2;
printf("HELLO, WELCOME TO ROCK, PAPER, SCISSORS GAME\nWhat is player1's name?\n ");
scanf("%s",&player1);
@saiedabbas93
saiedabbas93 / output
Created August 15, 2019 22:58
Leap_year.c
#include<stdio.h>
#include<conio.h>
void main()
{
int year;
printf("Enter the year\n");
scanf("%d",&year);
if(year%4==0)
{
@saiedabbas93
saiedabbas93 / OUTPUT
Last active August 17, 2019 02:48
If you input the date, the code will tell what day it will be.
day=
16
Type the following codes for the required month
March-1 April-2 May-3 June-4
July-5 AUgust-6 September-7 October-8
November-9 December-10 January-11 Febraury-12
6
Last 2 digits of year=
19
first 2 digits of year=
@saiedabbas93
saiedabbas93 / octal.c
Created August 29, 2019 17:01
Decimal to octal number
#include<stdio.h>
void main()
{
int num,i,d1,r1,d2,r2,d3,r3,d4,r4,d5,r5,d6,r6,d7,r7,d8,r8,d9,r9,octal;
printf("Enter the num ");
scanf("%d",&num);
printf("DECIMAL\tOCTAL\n");
for(i=0;i<=num;i++)
#include <stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int i,j,k,power,a,d1,b,d2,c,d3,d,d4,e,d5;
for(i=0;i<=4;i++)
{
for(j=8;j>i;j--)
@saiedabbas93
saiedabbas93 / odd_even.c
Created August 15, 2019 19:44
Any integer is input through the keyboard. Write a program to find out whether it is an odd number or even number.
#include<stdio.h>
#include<conio.h>
void main()
{
int num,result;
printf("Enter the number\n");
scanf("%d",&num);
result=num%2;
if (result==0)
@saiedabbas93
saiedabbas93 / STONE_PAPER_SCISSORS.c
Last active January 8, 2022 16:50
STONE/ROCK PAPER SCISSORS GAME BETWEEN TWO PLAYERS IN C PROGRAM
#include<stdio.h>
#include<conio.h>
void main()
{
char player1[10],player2[10];
int in1,in2;
printf("HELLO, WELCOME TO ROCK, PAPER, SCISSORS GAME\nWhat is player1's name?\n ");
scanf("%s",&player1);
printf("What is player2's name?\n ");
scanf("%s",&player2);
@saiedabbas93
saiedabbas93 / Costprice_if_else.c
Last active January 24, 2023 11:20
If cost price and selling price of an item is input through the keyboard, write a program to determine whether the seller has made profit or incurred loss. Also determine how much profit he made or loss he incurred.
#include<stdio.h>
#include<conio.h>
void main()
{
int cp,sp,tl,tp;
printf("Enter the Cost price\n");
scanf("%d",&cp);
printf("Enter the Selling price\n");
scanf("%d",&sp);