Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
7 views
Tol Lab
tol lab
Uploaded by
mamane bello
AI-enhanced title
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download now
Download
Save TOL LAB For Later
Download
Save
Save TOL LAB For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
7 views
Tol Lab
tol lab
Uploaded by
mamane bello
AI-enhanced title
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download now
Download
Save TOL LAB For Later
Carousel Previous
Carousel Next
Save
Save TOL LAB For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 6
Search
Fullscreen
1: //Check if a given string has even a or not.
Make sure that string is made up of on
2: #include<stdio.h>
3: #include<conio.h>
4: #include<string.h>
5: int main()
6: {
7: int i,a,c=0,f=0;
8: char A[50];
9: printf("Enter the string\n");
10: scanf("%s",&A);
11: for(i=0;i<strlen(A);i++)
12: {
13: if(A[i]=='a')
14: {
15: c=c+1;
16: }
17: }
18: if(c%2==0)
19: {
20: printf("\nThe Given string have even number of a's ");
21: }
22: else
23: {
24: printf("\nThe Given string not have even number of a's ");
25: }
26:
27: for(i=0;i<strlen(A);i++)
28: {
29: if(A[i]=='a'|| A[i]=='b')
30: {
31: f=f;
32: }
33: else
34: {
35: f=1;
36: }
37: }
38: if(f==1)
39: {
40: printf("\nThe string also contains other than a and b.");
41: }
42: else
43: {
44: printf("\nThe string is made up of only a and b.");
45: }
46: return 0;
47: }
1: //Check if a given string has even a and odd b. String should made up of only a and
2: #include<stdio.h>
3: #include<conio.h>
4: #include<string.h>
5: int main()
6: {
7: int i,a,ac=0,bc=0,f=0;
8: char A[50];
9: printf("Enter the string\n");
10: scanf("%s",&A);
11: for(i=0;i<strlen(A);i++)
12: {
13: if(A[i]=='a')
14: {
15: ac=ac+1;
16: }
17: if(A[i]=='b')
18: {
19: bc=bc+1;
20: }
21: }
22: if(ac%2==0&&bc%2==0)
23: {
24: printf("\nThe Given string have even number of a's and b's");
25: }
26: else if(ac%2==0&&bc%2!=0)
27: {
28: printf("\nThe Given string have even number of a's and odd number of b's");
29: }
30: else if(ac%2!=0&&bc%2!=0)
31: {
32: printf("\nThe Given string have odd number of a's and b's");
33: }
34: else
35: {
36: printf("\nThe Given string have odd number of a's and even number of b's");
37: }
38:
39: for(i=0;i<strlen(A);i++)
40: {
41: if(A[i]=='a'|| A[i]=='b')
42: {
43: f=f;
44: }
45: else
46: {
47: f=1;
48: }
49: }
50: if(f==1)
51: {
52: printf("\nThe string also contains other than a and b.");
53: }
54: else
55: {
56: printf("\nThe string is made up of only a and b.");
57: }
58: return 0;
59: }
1: //Check if a sting over 0 and 1 ends with 0.
2: #include<stdio.h>
3: #include<conio.h>
4: #include<string.h>
5: int main()
6: {
7: int i,a,f=0,n;
8: char A[50];
9: printf("Enter the string\n");
10: scanf("%s",&A);
11: n=strlen(A);
12: for(i=0;i<strlen(A);i++)
13: {
14: if(A[i]=='0'|| A[i]=='1')
15: {
16: f=f;
17: }
18: else
19: {
20: f=1;
21: }
22: }
23: if(A[n-1]=='0'&&f==0)
24: {
25: printf("\n\nThe given string is over 0 and 1 ends with 0");
26: }
27: else if(A[n-1]!='0'&&f==0)
28: {
29: printf("\n\nThe given string is over 0 and 1 not ends with 0");
30: }
31: else
32: {
33: printf("\n\nThe given string is not over 0 and 1 only it also contains other than 0 and
34: }
35: return 0;
36: }
37:
1: //Check if a given string is a valid integer.
2: #include<stdio.h>
3: #include<conio.h>
4: #include<string.h>
5: int main()
6: {
7: int i,j,a,f1=0,f2=0,n;
8: char A[50],D[20]="+-0123456789";
9: printf("Enter the string\n");
10: scanf("%s",&A);
11: for(i=0;i<strlen(D);i++)
12: {
13: if(A[0]==D[i])
14: {
15: f1=1;
16: }
17: }
18: if(f1==1)
19: {
20: for(i=1;i<strlen(A);i++)
21: {
22: f2=0;
23: for(j=2;j<strlen(D);j++)
24: {
25: if(A[i]==D[j])
26: {
27: f2=1;
28: }
29: }
30: if(f2==0)
31: {
32: printf("\nInvalid Integer String\n");
33: break;
34: }
35: }
36: if(f2==1)
37: {
38: printf("\nValid Integer String\n");
39: }
40: }
41: else
42: {
43: printf("\nInvalid Integer String\n");
44: }
45: return 0;
46: }
47:
1: //Check if a given string is a valid identifier.
2: #include<stdio.h>
3: #include<conio.h>
4: #include<string.h>
5: int main()
6: {
7: int i,j,a,f1=0,f2,n;
8: char A[50],D[70]="abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVXXYZ_",D2[60]="_
9: printf("Enter the string\n");
10: //scanf("%s",&A);
11: gets(A);
12: printf("%s",A);
13: for(i=0;i<strlen(D2);i++)
14: {
15: if(A[0]==D2[i])
16: {
17: f1=1;
18: }
19: }
20: if(f1==1)
21: {
22: for(i=1;i<strlen(A);i++)
23: {
24: f2=0;
25: for(j=0;j<strlen(D);j++)
26: {
27: if(A[i]==D[j])
28: {
29: f2=1;
30: }
31: }
32: if(f2==0)
33: {
34: printf("\nInvalid Identifier.. \n");
35: break;
36: }
37: }
38: if(f2==1)
39: {
40: printf("\nValid Identifier.. \n");
41: }
42: }
43: else
44: {
45: printf("\nInvalid Identifier..\n");
46: }
47: return 0;
48: }
49:
50:
1: //Check if a string over a and b is a palindrome.
2: #include<stdio.h>
3: #include<conio.h>
4: #include<string.h>
5: int main()
6: {
7: int i,a,f1=0,f2=0,n,m;
8: char A[50];
9: printf("Enter the string\n");
10: scanf("%s",&A);
11: for(i=0;i<strlen(A);i++)
12: {
13: if(A[i]=='a'|| A[i]=='b')
14: {
15: f1=f1;
16: }
17: else
18: {
19: f1=1;
20: }
21: }
22: m=strlen(A)/2;
23: n=strlen(A)-1;
24: for(i=0;i<m;i++)
25: {
26: if(A[i]!=A[n-i])
27: {
28: f2=1;
29: }
30: }
31: if(f1==1&&f2==0)
32: {
33: printf("\nThe string also contains other than a and b. It creates palindrome.\n");
34: }
35: else if(f1==0&&f2==1)
36: {
37: printf("\nThe string is made up of only a and b. It Not Creates palindrome.\n");
38: }
39: else if(f1==0&&f2==0)
40: {
41: printf("\nThe string is made up of only a and b. It Creates palindrome.\n");
42: }
43: else
44: {
45: printf("\nInvalid string\n");
46: }
47: return 0;
48: }
You might also like
Pharmacy Management System
PDF
33% (3)
Pharmacy Management System
17 pages
Device Management Functional Overview
PDF
100% (4)
Device Management Functional Overview
46 pages
Assignment 3
PDF
No ratings yet
Assignment 3
10 pages
Psap CP My Codes
PDF
No ratings yet
Psap CP My Codes
24 pages
Compiler Design: Department of Computer Science & Faculty of Engineering
PDF
No ratings yet
Compiler Design: Department of Computer Science & Faculty of Engineering
27 pages
Experiment - 1: Aim: Write A C Program To Design Lexical Analyzer Which Will Identify Keywords, Identifiers, Source Code
PDF
No ratings yet
Experiment - 1: Aim: Write A C Program To Design Lexical Analyzer Which Will Identify Keywords, Identifiers, Source Code
5 pages
All Document Reader 1729225123806
PDF
No ratings yet
All Document Reader 1729225123806
69 pages
CD Lab Manual - Word
PDF
No ratings yet
CD Lab Manual - Word
42 pages
DSA MANUAL SH
PDF
No ratings yet
DSA MANUAL SH
50 pages
Compiler Design labs
PDF
No ratings yet
Compiler Design labs
25 pages
DOC-20220916-WA0001.pdf
PDF
No ratings yet
DOC-20220916-WA0001.pdf
7 pages
CD Programs PDF
PDF
No ratings yet
CD Programs PDF
18 pages
DS Lab Mannual (1)
PDF
No ratings yet
DS Lab Mannual (1)
57 pages
dsaf
PDF
No ratings yet
dsaf
31 pages
String Exercise - C Programming
PDF
No ratings yet
String Exercise - C Programming
8 pages
CD 1
PDF
No ratings yet
CD 1
18 pages
Practical File: Department of Computer Science and Engineering
PDF
No ratings yet
Practical File: Department of Computer Science and Engineering
32 pages
CD_LAB
PDF
No ratings yet
CD_LAB
36 pages
Problem solving and programming
PDF
No ratings yet
Problem solving and programming
13 pages
Subjective Assignment 03 Ifelse Ans
PDF
No ratings yet
Subjective Assignment 03 Ifelse Ans
13 pages
DS LAB MANUAL_Deepa
PDF
No ratings yet
DS LAB MANUAL_Deepa
42 pages
Lab1 (1) Compiler
PDF
No ratings yet
Lab1 (1) Compiler
4 pages
Compiler-Design
PDF
No ratings yet
Compiler-Design
51 pages
CD lab (1)
PDF
No ratings yet
CD lab (1)
27 pages
CD Lab Manual Final
PDF
No ratings yet
CD Lab Manual Final
51 pages
The VTU Blogger: Data Structures Lab Programs
PDF
No ratings yet
The VTU Blogger: Data Structures Lab Programs
40 pages
Write A Program in C To Check Whether A Entered Number Is Positive, Negative or Zero
PDF
No ratings yet
Write A Program in C To Check Whether A Entered Number Is Positive, Negative or Zero
10 pages
CD Lab Programs
PDF
No ratings yet
CD Lab Programs
43 pages
Indira Gandhi Delhi Technical University For Women
PDF
No ratings yet
Indira Gandhi Delhi Technical University For Women
29 pages
All C Programs Database
PDF
No ratings yet
All C Programs Database
13 pages
maths
PDF
No ratings yet
maths
20 pages
DSA
PDF
No ratings yet
DSA
64 pages
Compiler Lab Report, DIU
PDF
No ratings yet
Compiler Lab Report, DIU
13 pages
CD Lab Manual
PDF
No ratings yet
CD Lab Manual
71 pages
LAB Manual: School of Engineering and Technology
PDF
No ratings yet
LAB Manual: School of Engineering and Technology
33 pages
Pasap Important Questions
PDF
No ratings yet
Pasap Important Questions
38 pages
DSA programs
PDF
No ratings yet
DSA programs
20 pages
DS LAB PROGRAMS.RK
PDF
No ratings yet
DS LAB PROGRAMS.RK
31 pages
Lab_Report
PDF
No ratings yet
Lab_Report
32 pages
I)
PDF
No ratings yet
I)
5 pages
cd lab answers
PDF
No ratings yet
cd lab answers
19 pages
University of Calcutta: Programming Through C Language and HTML
PDF
No ratings yet
University of Calcutta: Programming Through C Language and HTML
35 pages
English_lab_book.pdf.pdf
PDF
No ratings yet
English_lab_book.pdf.pdf
11 pages
PST Programs
PDF
No ratings yet
PST Programs
14 pages
C Program To Find Maximum Between Two Numbers
PDF
No ratings yet
C Program To Find Maximum Between Two Numbers
14 pages
EXP1
PDF
No ratings yet
EXP1
6 pages
C PROGRAMMING EXERCISE
PDF
No ratings yet
C PROGRAMMING EXERCISE
4 pages
trail_dc
PDF
No ratings yet
trail_dc
33 pages
program 1-7
PDF
No ratings yet
program 1-7
21 pages
CD_LAB_MANUAL
PDF
No ratings yet
CD_LAB_MANUAL
37 pages
Data Structures Lab Programs Fibonacci
PDF
No ratings yet
Data Structures Lab Programs Fibonacci
53 pages
Fa19 BCS 139 Dsa LS1
PDF
No ratings yet
Fa19 BCS 139 Dsa LS1
2 pages
Program & Output Without Result
PDF
No ratings yet
Program & Output Without Result
89 pages
Compiler Design Lab
PDF
No ratings yet
Compiler Design Lab
18 pages
Lab3 2023103623
PDF
No ratings yet
Lab3 2023103623
12 pages
CD Lab5
PDF
No ratings yet
CD Lab5
6 pages
Token Sep
PDF
No ratings yet
Token Sep
3 pages
cd-lab-ans
PDF
No ratings yet
cd-lab-ans
7 pages
Compilerdesign2 0
PDF
No ratings yet
Compilerdesign2 0
52 pages
CD Lab Manual
PDF
No ratings yet
CD Lab Manual
31 pages
Mukesh Ds Practical File
PDF
No ratings yet
Mukesh Ds Practical File
66 pages
Computer Engineering Laboratory Solution Primer
From Everand
Computer Engineering Laboratory Solution Primer
Karan Bhandari
No ratings yet
Blending Module PDF
PDF
No ratings yet
Blending Module PDF
2 pages
Unix Awk If
PDF
No ratings yet
Unix Awk If
35 pages
Finals
PDF
No ratings yet
Finals
15 pages
History of Scratch
PDF
0% (1)
History of Scratch
4 pages
Eldhose Mathew EA Aug 2015
PDF
No ratings yet
Eldhose Mathew EA Aug 2015
3 pages
IT Certification Roadmap: Certifications Validate Expertise in Your Chosen Career
PDF
No ratings yet
IT Certification Roadmap: Certifications Validate Expertise in Your Chosen Career
2 pages
Match Group v. Tantan - Complaint
PDF
No ratings yet
Match Group v. Tantan - Complaint
44 pages
$38k California Backpay by @onlydixonstreet
PDF
No ratings yet
$38k California Backpay by @onlydixonstreet
11 pages
7736-K901
PDF
No ratings yet
7736-K901
9 pages
Lab Record DEV
PDF
100% (1)
Lab Record DEV
28 pages
Signal and System Experiment
PDF
No ratings yet
Signal and System Experiment
62 pages
MSW Logo Intro
PDF
No ratings yet
MSW Logo Intro
20 pages
Teori Computational Thinking I PDF
PDF
No ratings yet
Teori Computational Thinking I PDF
41 pages
DX200 Operators Manual Material Handling (RE-CSO-A049.0)
PDF
No ratings yet
DX200 Operators Manual Material Handling (RE-CSO-A049.0)
635 pages
Fofrface-To-many - Run With An API On Replicate
PDF
No ratings yet
Fofrface-To-many - Run With An API On Replicate
1 page
Vmware Trustpoint Solution Overview
PDF
No ratings yet
Vmware Trustpoint Solution Overview
3 pages
An Overview of Social Engineering Malware Trends, Tactics, and Implications
PDF
No ratings yet
An Overview of Social Engineering Malware Trends, Tactics, and Implications
14 pages
ID CARD GENERATOR SYSTEM (12th Maths)
PDF
No ratings yet
ID CARD GENERATOR SYSTEM (12th Maths)
26 pages
Professional Reference Letter Apartment
PDF
100% (1)
Professional Reference Letter Apartment
7 pages
DDR-SDRAM Controller ASIC Design For High Speed Interfacing
PDF
No ratings yet
DDR-SDRAM Controller ASIC Design For High Speed Interfacing
5 pages
Program Delivery Plan
PDF
No ratings yet
Program Delivery Plan
17 pages
Talend Big Data Reading A File
PDF
No ratings yet
Talend Big Data Reading A File
2 pages
DBMS Practical Example For Students
PDF
No ratings yet
DBMS Practical Example For Students
33 pages
Troubleshooting Low TBF Establishment Success Rates
PDF
No ratings yet
Troubleshooting Low TBF Establishment Success Rates
8 pages
Ques bank ldco unit 4
PDF
No ratings yet
Ques bank ldco unit 4
2 pages
TM-100-Datasheet-Working-1
PDF
No ratings yet
TM-100-Datasheet-Working-1
2 pages
Judge Chen's Costs Order in Prenda-Navasca Case
PDF
No ratings yet
Judge Chen's Costs Order in Prenda-Navasca Case
9 pages