Home Blog

0 120
Convert Char To Uppercase

AIM: Program on function to scan a character string and Convert Char To Uppercase

2) ALGORITHM:

step1: start
Step2: take a string a function of return value data type is void str upper
Step3: read a string
While (s[i]! =’\0’)
{
if((s[i]>=’a’) &&(s[i]<=’z’))
s[i]=s[i]-32;
i++;
}
display changed string.
Step4: stop

3) FLOWCHART:

Program on function to scan a character string and Convert Char To Uppercase

Convert Char To Uppercase

Convert Char To Uppercase

4) PROGRAM:

Program on function to scan a character string and Convert Char To Uppercase
#include<stdio.h>
#include<conio.h>
void main()
{
char str;
printf(“enter a string”);
scanf(“%s”,str);
to_str_upper(char[]);
printf(“changed to %s”,str);
}
void to_str_upper(char[])
{
int i=0;
while(s[i]!=’\0′)
{
if((s[i]>=’a') && (s[i]>=’z'))
s[i]=s[i]-32;
i++;
}
}
}

5) Result:

Enter a string
chary
changed to CHARY
  1. www.btechtutorials.com

  2. www.btechtutorials.in

  3. www.cprograms.org

  4. www.apschoolsinfo.com

  5. www.funfb.org

0 83
Read Students Data

AIM: program to read number of student data

2) ALGORITHM:

step1: take a character array a, integers r,s,I,j and n
step2: read the value of n
step3: for(i=0;i<n;i++)
Enter rollno,name,,,,,,
Read these and enter 5 subject marks
s[i][5]=0;
for(j=0;j<5;j++)
{
scanf(“%d”,s[i][j]);
s[i][5]=s[i][5]+s[i][j];
}
step4:display n[i],r[i],s[i][j]
step5:stop

3) FLOWCHART:

Program to read number of student data

Read Number Of Student Data

Read Number Of Student Data

4) PROGRAM:

Program to read number of student data
#include<stdio.h>
#include<conio.h>
void main()
{
char n[20][10];
int i,j,r[20],s[20][6];
printf(“enter n value”);
scanf(“%d”,&n);
for(i=0;i<n;i++)
{
printf(“enter name,rollno,….”);
scanf(“%s%d”,&n[i],&r[i]);
printf(“enter 5 subject marks”);
s[i][5]=0;
for(j=0;j<5;j++)
{
scanf(“%d”,s[i][j]);
s[i][5]=s[i][5]+s[i][j];
}
}
printf(“the data entered is \n”);
for(i=0;i<n;i++)
{
printf(“%s\t%d\t”,n[i],r[i]);
for(j=0;j<5;j++)
printf(“%d\t”,s[i][j]);
}
getch();
}

5) Result:

Enter name,rollno,….Chary 20
Enter 5 subject marks
10 50 34 06 42
The data entered is
Nag 20 10 50 34 06 42
  1. www.btechtutorials.com

  2. www.btechtutorials.in

  3. www.cprograms.org

  4. www.apschoolsinfo.com

  5. www.funfb.org

0 88

AIM: Program to print Fibonacci series

2) ALGORITHM:

Step1: start
Step2: read I,x,f,f1,f2
Step3: f=0,f1=1,f2=1
Step4: do
I++
F1=f2
F2=f
F=f1+f2
While (i<=n)
Step5: print f
Step6: stop

3) FLOWCHART:

Program to print Fibonacci series

Print Fibonacci Series

Print Fibonacci Series

4) PROGRAM:

Program to print Fibonacci series
void main()
{
int i,n,f,f1,f2;
printf(“enter the range”);
scanf(“%d”,&n);
f=0;
f1=1;
f2=1;
do
{
i++;
printf(“%d\n”,f);
f1=f2;
f2=f;
f=f1+f2;
}
while(i<=n);
}

5) Result:

Enter the range 9
0 1 1 2 3 5 8 13 21
  1. www.btechtutorials.com

  2. www.btechtutorials.in

  3. www.cprograms.org

  4. www.apschoolsinfo.com

  5. www.funfb.org

0 101
MatrixMultiplication

AIM: Program to print product of two matrices

2) ALGORITHM:

Step1: start
Step2:read I,j,k,a[3][3],b[3][2],c[3][2]
Step3: read a[3][3] & b[3][2]
Step 4:i=0,j=0,k=0
Step5: if i Step6: if j Step7: if k Step8: c[i][j]=c[i][j]+a[k][j]*b[i][k]
Step9: print a[i][j],b[i][j],c[i][j]
Step 10: stop

3) FLOWCHART:

Program to print product of two matrices.

Product Of Two Matrices

Product Of Two Matrices

4) PROGRAM:

Program to print product of two matrices
#include
void main()
{
int i,j,k,a[3][3],b[3][2],c[3][2];
printf(“enter elements of matrix a”);
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
scanf(“%d”,&a[i][j]);
}
printf(“enter elements of matrix b”);
for(i=0;i<3;i++)
{
for(j=0;j<2;j++)
scanf(“%d”,&b[i][j]);
}
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
c[i][j]=0;
for(k=0;k<3;k++)
{
c[i][j]=c[i][j]+a[i][k]*b[k][j];
printf(“t%d”,c[i][j]);
}
printf(“n”);
}
}
}
}

5) Result:

Enter the elements of matrix a
1 2 4 5 2 1 4 5 2
Enter the elements of matrix b
1 2 4 5 2 1 4 5 2
10 18 28
50 18 7
40 45 14
  1. www.btechtutorials.com

  2. www.btechtutorials.in

  3. www.cprograms.org

  4. www.apschoolsinfo.com

  5. www.funfb.org

0 62
total of even integers

AIM: Program to find total of odd integers

2) ALGORITHM:

step1: start
step2: for(i=0;i<20;i++)
{
if(a[i]%2==1)
sum=sum+a[i];
}
step3:stop

3) FLOWCHART:

Total Of Odd Integers

Total Of Odd Integers

4) PROGRAM:

Program to find total of odd integers
#include
main()
{
int a[20],i,sum=0;
printf(“enter 5 integrs”);
for(i=0;i<5;i++)
scanf(“%d”,&a[i]);
for(i=0;i<5;i++)
{
if(a[i]==1)
sum=sum+a[i];
}
prinf(“sum =%d”,sum);
getch();
}

5) Result:

Enter 5 integers
1 2 3 4 5
Sum=9
  1. www.btechtutorials.com

  2. www.btechtutorials.in

  3. www.cprograms.org

  4. www.apschoolsinfo.com

  5. www.funfb.org

0 80
total of even integers

AIM: Program to find total of even integers

2) ALGORITHM:

step1: start
step2: for i=0;i<20;i++
if(a[i]%2==0)
sum=sum+a[i];
step3: stop
To find total of even integer.

3) FLOWCHART:

Program to find total of even integers
total of even integers

total of even integers

4) PROGRAM:

Program to find total of even integers
#include<stdio.h>
main()
{
int a[20],i,sum=0;
printf(“enter5 integrs”);
for(i=0;i<5;i++)
scanf(“%d”,&a[i]);
for(i=0;i<5;i++)
{
if(a[i]==0)
sum=sum+a[i];
}
prinf(“sum =%d”,sum);
getch();
}

5) Result:

Entger 5 integers
2 4 6 8 2
Sum = 22
  1. www.btechtutorials.com

  2. www.btechtutorials.in

  3. www.cprograms.org

  4. www.apschoolsinfo.com

  5. www.funfb.org