Hello Here is C Program to Find the Location (Place) of a Character That one Lies at Last.
Example: In Apple find P. Answer is 2. In Sagar Find a. Answer is 3. Else Not Found print no found.
And First we find the total character and run the loop from Back and find the the character if found break the loop. else Display not found.
Hello Here is a C program to Swipe a Two Variables With out the use of other verifiable.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include<stdio.h>
void main()
{
int a,b;
printf ("Enter the value of A:- ");
scanf ("%d",&a);
printf ("Enter the value of B:- ");
scanf ("%d",&b);
printf("%d is A and %d is B\n",a,b);
a=a+b;
b=a-b;
a=a-b;
printf("%d is A and %d is B\n",a,b);
}
#include<stdio.h>
void read(int,int,int [][20]);
void add(int,int,int [][20],int [][20],int [][20]);
void display(int,int,int [][20]);
void main()
{
int r,c,mat[20][20],sem[20][20],sum[20][20];
printf("Enter the Value of Row and Column:- \n");
scanf("%d %d",&r, &c);
printf("Enter the First Matrix:- \n");
read(r,c,mat);
printf("Enter the Second Matrix:- \n");
read(r,c,sem);
add(r,c,mat,sem,sum);
printf("The Sum matrix is:- \n");
display(r,c,sum);
}
void read(int x,int y,int ma[20][20])
{
int i,j;
for (i=0;i<x;i++)
{
for(j=0;j<y;j++)
{
scanf("%d",&ma[i][j]);
}
}
}
void add(int x, int y,int right[20][20],int left[20][20],int ans[20][20])
{
int i,j;
for (i=0;i<x;i++)
{
for(j=0;j<y;j++)
{
ans[i][j]=right[i][j]+left[i][j];
}
}
}
void display(int x,int y, int ma[20][20])
{
int i,j;
for (i=0;i<x;i++)
{
for(j=0;j<y;j++)
{
printf("%d\t",ma[i][j]);
}
printf("\n");
}
}
The Process is Quite simple in add function we pass 3 matrix so that can store the sum in one of the matrix and display it.
Hello Write some things here
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include<stdio.h>
void read(int, int []);
void display(int, int []);
void sort(int, int []);
void main()
{
int num, data[50];
printf("Enter Total no of value to be sorted in Accessending Order:- ");
scanf("%d",&num);
read(num, data);
sort(num, data);
printf("After SUcessful Arangement in Accessending Order:- \n");
display(num,data);
}
void read(int x, int thedata[50])
{
int i;
printf("Enter the values to be inserted in the array:-\n");
for(i=0;i<x;i++)
{
scanf("%d",&thedata[i]);
}
}
void sort(int x, int thedata[50])
{
int i,j,tmp;
for(i=0;i<x-1;i++)
{
for (j=0;j<x-1;j++)
{
if(thedata[j]>thedata[j+1])
{
tmp=thedata[j];
thedata[j]=thedata[j+1];
thedata[j+1]=tmp;
}
}
}
}
void display(int x, int thedata[50])
{
int i;
for(i=0;i<x;i++)
{
printf("%d\t",thedata[i]);
}
}
Here we Use a function to read another to sort and another to display. As passing array is call by reference we need not to return individual value.
Hello Read a String from Users and Print It in Multi line using new line after every words. Read a String "my name is sagar Devkota" and Print it as:-
My
Name
Is
Sagar
Devkota
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include<stdio.h>
void nline(char []);
void main()
{
char asent[100];
int i;
printf("Enter a line of string:- \n");
gets(asent);
nline(asent);
puts(asent);
}
void nline(char thesent[100])
{
int i;
for (i=0;thesent[i]!='\0';i++)
{
if (thesent[0]>='a' && thesent[0]<='z')
thesent[0]=thesent[0]-32;
if(thesent[i]==' ')
{
thesent[i]='\n';
if(thesent[i+1]>='a' && thesent[i+1]<='z')
thesent[i+1]=thesent[i+1]-32;
}
}
}
Here we Check the case of First and make it capital if it was small. Then check every space and replace it with Newline "\n". and Make Capital all after that space.
Hello Here is a program to count the UPPERCASE lowercase and Total Characters in a String.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include<stdio.h>
#define MAX 100
int ucase(char asent[]);
int lcase(char asent[]);
int total(char asent[]);
void main()
{
int u,l,t;
char asent[MAX];
printf("Enter a Sentence:-\n");
gets(asent);
u=ucase(asent);
l=lcase(asent);
t=total(asent);
printf("In the Sentence ");
puts(asent);
printf("Total Letters are %d. Among them %d are UPPERCASE and %d are lowercase",t,u,l);
}
int ucase(char thesent[MAX])
{
int i,count=0;
for (i=0;thesent[i]!='\0';i++)
{
if(thesent[i]>='A' && thesent[i]<='Z')
count++;
}
return (count);
}
int lcase(char thesent[MAX])
{
int i,count=0;
for (i=0;thesent[i]!='\0';i++)
{
if(thesent[i]>='a' && thesent[i]<='z')
count++;
}
return (count);
}
int total(char thesent[MAX])
{
int i,count=0;
for (i=0;thesent[i]!='\0';i++)
{
count++;
}
return (count);
}
We pass the string and Check their case and increment if they are with in the boundary.
Hello Here is A program to Print the Prime Number up to That Number which is inserted by users. Here we are using function. If you are not using function yet You can read the number in second function and process.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include<stdio.h>
void prime(int);
void main()
{
int num;
printf("Enter a Number up to which the prime numbers to be printed:- ");
scanf("%d",&num);
prime(num);
}
void prime(int a)
{
int i,j;
printf("1\t2\t");
for (i=3;i<=a;i++)
{
for (j=2;j<i;j++)
{
if ((i%j)==0)
break;
}
if(i==j)
printf("%d\t",i);
}
}
Here we ask users for the max number up to which we need to print out the prime number and from there. we Pass that value to The function and Display the value.
Hello this is a program to convert a Line string to multyline by inserting newline in every space and Capatalize the first word of all line.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include<stdio.h>
void main()
{
char asent[100];
int i;
printf("Enter a line of string:- \n");
gets(asent);
puts(asent);
for (i=0;asent[i]!='\0';i++)
{
if (asent[0]>='a' && asent[0]<='z')
asent[0]=asent[0]-32;
if(asent[i]==' ')
{
asent[i]='\n';
if(asent[i+1]>='a' && asent[i+1]<='z')
asent[i+1]=asent[i+1]-32;
}
}
puts(asent);
}
Write a program to Read the string "My name is sagar devkota" and convert it in the following form using loop:-
My
Name
Is
Sagar
Devkota
Here in the above program we check the Case of first word and make it capital if needed and check every space and replace it with newline and check the case of next word and change its case to Uppercase and display at last.
Hello Here is a program to convert A string inserted from users to lower case.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include<stdio.h>
void main()
{
char cname[100];
int i;
printf("Enter the name of your collage:-\n");
gets(cname);
for (i=0;cname[i]!='\0';i++)
{
if(cname[i]>='A' && cname[i]<='Z')
cname[i]=cname[i]+32;
}
puts(cname);
}
Here the program checks every alphabet if they are Upper case it will change all of them into lowercase else they will be as it is.
Hello Here is a C program for matrix multiplication of size 3*3 Using function. This is the easiest process. From this code concept you can make multiplication of any size of matrix too. Just need to add some tmp locations.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
46
47
48
49
50
51
#include <stdio.h>
#include <stdlib.h>
void mult(int [][3],int [][3],int [][3]);
//Program for Multiplication of matrix 3*3 Time and Update
int main()
{
int a[3][3],b[3][3],c[3][3];
int i,j;
printf("Enter value of matrix A \n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
scanf("%d",&a[i][j]);
printf("\n");
}
printf("Enter value of matrix B \n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
scanf("%d",&b[i][j]);
printf("\n");
}
mult (a,b,c);
printf("https://timeandupdate.com \n");
printf("The Multiplication is :-\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
printf("%d\t",c[i][j]);
printf("\n");
}
return 0;
}
void mult(int x[][3],int y[][3],int z[][3])
{
int i,j,tmp1=0,tmp2=0,tmp3=0;
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
tmp1=x[i][j]*y[j][0]+tmp1;
tmp2=x[i][j]*y[j][1]+tmp2;
tmp3=x[i][j]*y[j][2]+tmp3;
}
z[i][0]=tmp1;
z[i][1]=tmp2;
z[i][2]=tmp3;
}
}
Here is the Output:
I did not check all but looks its correct.
The above program is compiled and successfully run on Code::Block 13.12.
This is easy program but you just need to focus. If you cant understand how this program flow don't forget to comment we will be back to help you.
Hello Here is a C program for matrix multiplication of size 3*3. This is the easiest process. From this code concept you can make multiplication of any size of matrix too. Just need to add some tmp locations.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <stdio.h>
#include <stdlib.h>
//Program for Multiplication of matrix 3*3 Time and Update
int main()
{
int a[3][3],b[3][3],c[3][3];
int i,j,k,tmp1=0,tmp2=0,tmp3=0;
printf("Enter value of matrix A \n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
scanf("%d",&a[i][j]);
printf("\n");
}
printf("Enter value of matrix B \n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
scanf("%d",&b[i][j]);
printf("\n");
}
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
tmp1=a[i][j]*b[j][0]+tmp1;
tmp2=a[i][j]*b[j][1]+tmp2;
tmp3=a[i][j]*b[j][2]+tmp3;
}
c[i][0]=tmp1;
c[i][1]=tmp2;
c[i][2]=tmp3;
}
printf("https://timeandupdate.com \n");
printf("The Multiplication is :-\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
printf("%d\t",c[i][j]);
printf("\n");
}
return 0;
}
Here is the Output:
I did not check all but looks its correct.
The above program is compiled and successfully run on Code::Block 13.12.
This is easy program but you just need to focus. If you cant understand how this program flow don't forget to comment we will be back to help you.
Hello Here is A c program to arrange numerical data in array in ascending order (1 3 8..). Input N numbers means you need to ask users how much numbers to be inserted. Here we are using max 10 Numbers if you need more you can from Changing the value a[10]. what ever you need. And you should change it in Called function too.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include<stdio.h>
#include<conio.h>
void asce(int[],int);
void main()
{
int a[10],n,i;
printf("Enter total no of array to be inserted in array:- ");
scanf("%d",&n);
printf("Enter value to be inserted in array");
for(i=0;i<n;i++)
scanf("%d",&a[i]);
asce(a,n);
printf("After arrranging in ascending order:- \n");
for(i=0;i<n;i++)
printf("%d\t",a[i]);
getche();
}
void asce(int a[10],int y)
{
int i,j,tmp;
for (i=0;i<y;i++)
{
for(j=0;j<y-1;j++)
{
if(a[j]>a[j+1])
{
tmp=a[j+1];
a[j+1]=a[j];
a[j]=tmp;
}
}
}
}
The main concept is the nested for loop. There are 100s ways to perform a program. The return type of called function is void as value is passed by reference.
Hello Here is a c program to find out the largest and the smallest numbers from 3 numbers reading those numbers from users.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include<stdio.h>
#include<conio.h>
int gre(int,int,int);
int sma(int,int,int);
void main()
{
int a,b,c,g,s;
printf("Enter 3 numbers:- \n");
scanf("%d %d %d", &a, &b, &c);
g=gre(a,b,c);
s=sma(a,b,c);
printf("%d is Greatest and %d is Smallest among %d, %d and %d",g,s,a,b,c);
getche();
}
int gre(int x,int y, int z)
{
int g;
if(x>y)
{
if(x>z)
g=x;
else
g=z;
}
else
{
if(y>z)
g=y;
else
g=z;
}
return (g);
}
int sma(int x,int y, int z)
{
int s;
if(x<y)
{
if(x<z)
s=x;
else
s=z;
}
else
{
if(y<z)
s=y;
else
s=z;
}
return (s);
}
Here we create two functions for finding smallest and greatest.
Hello Here is a program for Reading a number from user and print the factorial of that number using recursive function.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include<stdio.h>
#include<conio.h>
int factf(int);
void main()
{
int a, fact;
printf("enter a number to find its factorial:- ");
scanf("%d",&a);
fact=factf(a);
printf("Factorial is %d",fact);
getche();
}
int factf(int x)
{
int y=1;
if(x !=0)
y=x*factf(x-1);
return(y);
}
Recursive function is that function that falls it self. We should set certain conditions if not the program will be of infinite loop.
System Software
The set of instruction that serves primarily as a connection link between computer hardware and application software.
Managing hardware resource, loading during first turn on.
System Software are the System Control Programs, The main System Control Program is Operating System.
Provides commonly used set of instructions for all applications.
Without it, the device is just a box(or a bar) with lights.
Operating Systems
An Operating System (OS) is an interface between a computer user and computer hardware.
An operating system is a software which performs all the basic tasks like file management, memory management, process management, handling input and output, and controlling peripheral devices such as disk drives and printers.
Operating system is the low-level software that supports a computer's basic functions, such as scheduling tasks and controlling peripherals.
1
2
3
4
5
6
#include<stdio.h>#include<conio.h>
main()
{
printf("Types of OS");
}
Common Operating System Task
Monitoring Performance
Correcting errors
Providing and maintaining the user interface
Starting(Booting)
Reading Programs into memory
Placing files and programs in secondary memory
Sanding jobs to hardwares
Maintaining security and limiting access
Locating files
Detecting virus
Compressing data
Formating diskettes
Controlling the computer monitor
Classification of OS
They can be classified into many types based on their interface, family,number of users they supports and source code.
Interface - CUI (Character User Interface) and GUI(Graohical User Interface)
Family - Unix Unix-like Linux Windows
Desktop Operating System, Departmental Operating System and Enterprise Operating System
Open Source, Closed Source, Partially open source
Desktop Operating System
Desktop Operating System supports a single users or some small group of people. These are those Operating system that most PC Users recognizes.
Unix-like (Mac OS,Solaris, FreeBSD,Linux,etc)
Linux - Yeah there are a ton of OS's under this. Ubuntu, Linux Mint, Fedora, Arch, Debian etc are few of the names I can think of right now.
Windows (95,98,ME,2000,NT,XP,Vista,7,8,10)
Departmental Operating System
For Departmental Operating system their Storage scalability, relibaility, backup, Security, multitasking, TCP/IP networking(Internate integration) etc also Networking management are the most.
The major departmental server operating systems includes UNIX Windows NT Server, IBM’s Os/2 Warp Server, Novell, Netware etc also IBM OS/400.
Enterprise Operating System
Enterprise Operating system system supports online applications, secure electronic commerce, miltiple concurrent users, large (Tbs) database, and millions of transaction per day.
The major enterprise operating systems includes IBM’s MSV(Multiple Virtual Storage) IBM’s VM(Virtual Machine), IBM’s VSE(Virtual Storage Extended) and Digital open VMS(Virtual machine system).
CUI (Character User Interface)
CUI means you have to take help of a keyboard to type commands to interact with the computer. You can only type text to give commands to the computer as in MS DOS or command prompt. There are no images or graphics on the screen and it is a primitive type of interface. Eg. MS DOS- OS for IBM PC
CUI’s have gradually become outdated with the more advanced GUI taking their place. However, even the most modern computers have a modified version of CUI called CLI (Command Line Interface). Linux
GUI(Graphical User Interface)
GUI is what most modern computers make use of. This is an interface that makes use of graphics, images and other visual clues such as icons. This interface made it possible for a mouse to be used with a computer and interaction really became very easy as the user could interact with just a click of the mouse rather than having to type every time to give commands to the computer. More the GUI More user friendly the OS be.
Example of OS
Windows is the most Used and most stable Operating System. Windows 95 first supports GUI among Microsoft Windows series.
Mac os x is one of the most user friendly Operating System. Developed by Apple Inc.
Android is a mobile open source operating system. Which uses the Linux kernel and written in java programming language
Linux is rapid growing operating System. Linux is the greatest success of Open Source GNU project. You can create your own version of Linux.
Other Type of OS
Batch operating system:- The users of a batch operating system do not interact with the computer directly. Each user prepares his job on an off-line device like punch cards and submits it to the computer operator.
Distributed operating System:- Distributed systems use multiple central processors to serve multiple real-time applications and multiple users. Data processing jobs are distributed among the processors accordingly.
Real Time operating System: A real-time system is defined as a data processing system in which the time interval required to process and respond to inputs is so small
Network operating System:- A Network Operating System runs on a server and provides the server the capability to manage data, users, groups, security, applications, and other networking functions.