Skip to main content
JustPaste
HomeAboutDonateContactTerms of UsePrivacy Policy

© 2026 Just Paste. All rights reserved.

Made with ❤️ by TakiDev

Untitled Page | JustPaste.app
Publish 4 months ago103 views

#include <stdio.h>

#include <string.h>

main()

{

char y[4],t;

do

{

char str[100];

int s2=0,s1=0,s3=0,s4=0,s5=0,i=0;

printf("\t\t\tCHARACTER CHECKING\n\t\t\t_________ ________\n\tInput\n\t=====\n\t\tEnter a string: ");

fgets(str, sizeof(str), stdin);

str[strcspn(str,"\n")] = 0;

while (str[i] !='\0')

{

if (str[i] == ' ')

{

s1++;

}

else if (!((str[i] >= 'a' && str[i] <= 'z') || (str[i] >= 'A' && str[i] <= 'Z') || (str[i] >= '0' && str[i] <= '9')))

{

s2++;

}

else if (str[i] >= 'a' && str[i] <= 'z')

s3++;

else if (str[i] >= 'A' && str[i] <= 'Z')

s4++;

else if (str[i] >= '0' && str[i] <= '9

')

s5++;

i++;

}

printf("\tOutput\n\t======\n\t\tNumber of special characters: %d\n\t\tNumber of spaces: %d\n\t\tNumber of lower case later: %d\n\t\tNumber of uper case later: %d\n\t\tNumber of digits: %d\n",s2, s1,s3,s4,s5);

printf("\n\n\t\t\t If you continue typr yes or no:");

scanf("%[^\n]s",&y);

scanf("%c",&t);

printf("______________________________________________________________________________");

}while (((strcmp(y,"yes"))==0)||((strcmp(y,"YES"))==0)||((strcmp(y,"Yes"))==0));

printf("\n\n\t\t\tThank you");

}

}

#include <stdio.h>

#include <string.h>

main()

{

float num1,num2,result;

char op;

float add(float num1, float num2);

float sub(float num1, float num2);

float divide(float num1, float num2);

float multiply(float num1, float num2);

do

{

printf("\t\t\tArithmatic operator\n\t\t\t========== ========\n\tInput\n\t=====\n\t\tEnter an operator (+, -, *, /): ");

scanf(" %c",&op);

printf("\t\tEnter 1st numbers: ");

scanf("%f", &num1);

printf("\t\tEnter 2nd numbers: ");

scanf("%f", &num2);

printf("\tOutput\n\t======\n");

switch (op)

{

case '+':

result = add(num1, num2);

printf("\t\t%.2f + %.2f = %.2f\n", num1, num2, result);

break;

case '-':

result = sub(num1, num2);

printf("\t\t%.2f - %.2f = %.2f\n", num1, num2, result);

break;

case '*':

result = multiply(num1, num2);

printf("\t\t%.2f * %.2f = %.2f\n", num1, num2, result);

break;

case '/':

result = divide(num1, num2);

if (num2 != 0)

{

printf("\t\t%.2f / %.2f = %.2f\n", num1, num2, result);

}

break;

default:

printf("\t\tError: Invalid operator entered.\n");

}

printf("\n\n\t\t\tIF YOU CONTINUE PRESS 1 : ");

scanf("%f",&num1);

printf("________________________________________________________\n\n");

}while (num1==1);

printf("\t\t\t THANK YOU");

}

float add(float num1, float num2)

{

return num1 + num2;

}

float sub(float num1, float num2)

{

return num1 - num2;

}

float multiply(float num1, float num2)

{

return num1 * num2;

}

float divide(float num1, float num2)

{

if (num2 != 0)

{

return num1 / num2;

}

else

{

printf("\t\tError: Division by zero is not allowed.\n");

}

return 0;

}

#include <stdio.h>

main()

{

int ch;

for(ch=1;ch==1;)

{

int n,i;

void m(int [],int);

printf("\t\t\tFuntion of array\n\t\t\t======= == =====\n\tInput\n\t=====\n\t\tEnter a size of array : ");

scanf("%d",&n);

int a [n];

for(i=0;i<n;i++)

{

printf("\t\tEnter elament %d : ",i+1);

scanf("%d",&a[i]);

}

m (a, n);

printf("\tOutput\n\t======\n\t\t");

for(i=0;i<n;i++)

{

printf("____");

}

printf("\n\t\t|");

for(i=0;i<n;i++)

{

printf(" %d |",a[i]);

}

printf("\t\t");

for(i=0;i<n;i++)

{

printf("____");

}

printf("\n");

printf("\n\n\t\t\t If you continue press 1 :");

scanf("%d",&ch);

}

printf("\n\n\t\t\tThank you");

}

void m(int a[],int n)

{

int i;

for(i=0;i<n;i++)

{

if (a[i]%2==0)

{

a[i]--;

continue;

}

else

{

a[i]++;

}

}

}

#include <stdio.h>

main()

{

int ch;

for(ch=1;ch==1;)

{

int n,i,r;

float m( int );

printf("\t\t\tNCR Formula\n\t\t\t=== =======\n\tInput\n\t=====\n\t\tEnter a n value : ");

scanf("%d",&n);

printf("\t\tEnter a r value : ");

scanf("%d",&r);

printf("\tOutput\n\t======\n\t\t");

printf("Result = %.2f\n",((m(n))/((m(r))*m(n-r))));

printf("\n");

printf("\n\n\t\t\t If you continue press 1 :");

scanf("%d",&ch);

}

printf("\n\n\t\t\tThank you");

}

float m(int n)

{

int i;

int f=1;

for(i=1;i<=n;i++)

{

f=f*i;

}

return f;

}

#include <stdio.h>

#include <string.h>

main()

{

char a[100][100];

int b[100][100];

float t;

int y = 1,p, m, i, j, rmax;

while (y == 1)

{

printf("\t\t\tPlayer Ranking Table\n\t\t\t====================\n\tInput\n\t_____\n\t\tEnter the number of players: ");

scanf("%d", &p);

printf("\t\tEnter the number of matches: ");

scanf("%d", &m);

for (i=0;i<p;i++)

{

printf("\t\tEnter name of player %d : ",i + 1);

scanf("%s",a[i]);

}

for (i =0;i<p;i++)

{

for (j = 0; j < m; j++)

{

printf("\t\tEnter runs for player %s in match %d: ",a[i], j + 1);

scanf("%d", &b[i][j]);

}

}

printf("\n\t\t\tPlayer Scores Table\n");

printf("\t\t\t_______________________\n");

printf("Player Name\t");

for (j=0;j<m;j++)

{

printf("Match %d\t", j + 1);

}

printf(" MAX \t AVG \n");

for (i = 0; i < p; i++)

{

printf("%s\t\t", a[i]);

rmax = b[i][0];

t=0;

for (j = 0; j < m; j++)

{

printf(" %d\t", b[i][j]);

if (b[i][j] > rmax)

{

rmax = b[i][j];

}

t=t+b[i][j];

}

printf(" %d\t %.2f\n", rmax,t/m);

}

printf("\n______________________________________________\n");

printf("If you want to continue, press 1: ");

scanf("%d", &y);

}

printf("\n\n\t\t\tThank you");

}

#include<stdio.h>

#include <string.h>

main()

{

int y=1,ch;

char a[100];

char b[100];

while(y==1)

{

printf("\t\t\tstring\n");

printf("\t\t\t======\n");

printf("\t\t1.Strcmp\n\t\t2.strlen\n\t\t3.strstr\n\t\t4.strcat\n\t\t5.strcpy\n");

printf("\t\tEnter a choice:");

scanf("%d",&ch);

switch(ch)

{

case 1:

printf("\t\t\tstring camparision\n\t\t\t==================\n\tInput\n\t=====\n\t\tEnter the first string: ");

scanf("%s", a);

getchar();

printf("\t\tEnter the second string: ");

scanf("%s",b);

printf("\toutput\n");

printf("\t======\n");

if (strcmp(a,b)==0)

{

printf("\t\tThe 1st and 2nd strings are equal\n");

}

else

{

printf("\t\tThe 1st and 2nd strings are not equal\n");

}

break;

case 2:

printf("\t\t\tfind the sting length\n\t\t\t=====================\n\tInput\n\t`````\n\t\tEnter a string:");

scanf("%s",a);

getchar();

printf("\toutput\n\t======\n\t\tLength of the string: %lu\n", strlen(a));

break;

case 3:

printf("\t\t\tFind the sub string\n\t\t\t=====================\n\tInput\n\t=====\n\t\tEnter the first string: ");

scanf("%s",a);

getchar();

printf("\t\tEnter the second string: ");

scanf("%s",b);

getchar();

printf("\toutput\n\t======\n");

if(strstr(a,b)!=0)

{

printf("\t\tsub string of first string=%s",b);

}

else

{

printf("\t\tThe string is not found");

}

break;

case 4:

printf("\t\t\t string cat\n\t\t\t===========\n\tInput\n\t=====\n\t\tEnter the first string: ");

scanf("%s",a);

getchar();

printf("\t\tEnter the second string: ");

scanf("%s",b);

getchar();

printf("\toutput\n\t======\n\t\tThe string =%s",strcat(a,b));

break;

case 5:

printf("\t\t\t string cpy\n\t\t\t===========\n\tInput\n\t=====\n\t\tEnter the first string: ");

scanf("%s", a);

getchar();

printf("\t\tEnter the second string: ");

scanf("%99[^\n]", b);

strcpy(a,b);

printf("\toutput\n\t======\n\t\tstring = %s\n", a);

break;

default:

printf("\t\tError: Invalid operator entered.\n");

}

printf("\n\n\t\t\tIf you want to continue, press 1: ");

scanf("%d", &y);

getchar();

}

printf("\n\n\t\t\tThank you");

}