Beruflich Dokumente
Kultur Dokumente
c=c-32;
}
else
{
c=c+32;
}
printf("New Character : %c",c);
}
INPUT
Enter Character : p
OUTPUT
New Character : P
Process returned 17 (0x11) execution time :
4.577 s
Press any key to continue.
/*
Roll No. : 13
Section : F
Problem Statement
*/
#include <stdio.h>
void main()
int a,b,c;
scanf("%d",&a);
scanf("%d",&b);
scanf("%d",&c);
else
}
/*
INPUT
Enter first number :1580
Enter second number :3082
Enter third number :2497
OUTPUT
Minimum among 1580,3082,2497 is : 1580
Process returned 38 (0x26) execution time :
13.381 s
Press any key to continue.
*/
/*
Roll No. : 13
Section : F
Problem Statement
*/
# include<stdio.h>
void main()
int m;
scanf("%d",&m);
if(m>80)
printf("Grade : A");
printf("Grade : B");
printf("Grade : C");
printf("Grade : D");
printf("Grade : E");
else
printf("Grade : F");}}
/*
INPUT
Enter marks of student :60
OUTPUT
Grade : C
Process returned 9 (0x9) execution time : 6.143 s
Press any key to continue.
*/
/*
Roll No. : 13
Section : F
Problem Statement
/#include <stdio.h>
scanf("%d",&a);
scanf("%d",&b);
printf("Press :\n");
scanf("%d",&c);
switch(c) { case 1 :
d = a%b;
break; case 2 :
d = a/b;
break; case 3 :
d = a*b;
break; case 4 :
d= a+b;
break; case 5 :
d = a-b;
*/
/*
Roll No. : 13
Section : F
Problem Statement
*/#include <stdio.h>
void main()
int n;
scanf("%d",&n);
for(int i=1;i<=n;i++)
for(int j=1;j<=n-i;j++)
printf(" ");
for(int k=1;k<=i;k++)
printf("%d",k);
for(int l=i-1;l>=1;l--)
printf("%d",l);
printf("\n");
}
/*
INPUT
Enter value of n :5
OUTPUT
1
121
12321
1234321
123454321
*/
/*
Name : Shrish Kumar
Roll No. : 13
Section : F
Problem Statement
Write a program to display reverse and number of digits of a number
*/#include <stdio.h>
void main()
{
int n,rev=0,sum=0,c=0;
printf("\t INPUT \n");
printf("Enter number :");
scanf("%d",&n);
while(n!=0)
{
int l = n%10;
rev = (rev*10)+l;
n=n/10;
c++;
}
printf("\t OUTPUT \n");
printf("Reverse of the number : %d\n",rev);
printf("Number of digits : %d",c);
}
/*
INPUT
Enter number :13542
OUTPUT
Reverse of the number : 24531
Number of digits : 5
Process returned 20 (0x14) execution time :
6.902 s
Press any key to continue.
*/
/*
Name : Shrish Kumar
Roll No. : 13
Section : F
Problem Statement
Write a program to print fibonacci series upto n terms
*/#include <stdio.h>
void main()
{
int n;
printf("\t INPUT \n");
printf("Enter limit : ");
scanf("%d",&n);
printf("\t OUTPUT \n");
printf("0,1");
int a=0,b=1;
for(int i=3;i<=n;i++)
{
int c = a+b;
printf(",%d",c);
a=b;
b=c;
}
}
/*
INPUT
Enter limit : 10
OUTPUT
0,1,1,2,3,5,8,13,21,34
Process returned 10 (0xA) execution time :
7.380 s
Press any key to continue.
*/
/*
Roll No. : 13
Section : F
Problem Statement
*/# include<stdio.h>
void main()
int n,c=0;
scanf("%d",&n);
for(int i=1;i<=n/2;i++)
if(n%i==0)
c++;
if(c==1)
else
printf("NO");
}
/*
INPUT
Enter number : 23
OUTPUT
YES
Process returned 5 (0x5) execution time : 4.929 s
Press any key to continue.
*/
/*
Roll No. : 13
Section : F
Problem Statement
*/
#include<stdio.h>
void main()
{ int a,b;
scanf("%d",&a);
scanf("%d",&b);
int arr[a],brr[b];
for(int i=0;i<a;i++)
for(int i=0;i<b;i++)
scanf("%d",&brr[i]); }
for(int i=0;i<b;i++)
{ crr[i]=arr[i]+brr[i]; }
for(int i=b;i<=a;i++)
{ crr[i]=arr[i]; }
for(int i=0;i<a;i++)
{ printf("%d\n",crr[i]); } }
for(int i=0;i<a;i++)
{ crr[i]=arr[i]+brr[i]; }
for(int i=a;i<=b;i++)
{ crr[i]=brr[i]; }
for(int i=0;i<b;i++)
{ printf("%d ",crr[i]); }}
/*
Input
Enter array 1 size : 5
Enter array 2 size : 8
Enter array 1 elements :1
Enter array 1 elements :2
Enter array 1 elements :3
Enter array 1 elements :4
Enter array 1 elements :5
Enter array 2 element :1
Enter array 2 element :3
Enter array 2 element :5
Enter array 2 element :7
Enter array 2 element :9
Enter array 2 element :4
Enter array 2 element :6
Enter array 2 element :2
Output
Final array :
2 5 8 11 14 4 6 2
Process returned 8 (0x8) execution time : 21.789 s
Press any key to continue.
*/
/*
Roll No. : 13
Section : F
Problem Statement
*/#include <stdio.h>
void main()
int k,n,c=0;
scanf("%d",&k);
scanf("%d",&n);
int A[n];
for(int i=0;i<n;i++)
scanf("%d",&A[i]);
if(A[i]==k)
c++;
if(c>0)
printf("Frequency of %d is : %d ",k,c);
else
}
/*
INPUT
Enter element to be found :2
Enter limit of array :10
Enter array element : 9
Enter array element : 2
Enter array element : 3
Enter array element : 2
Enter array element : 4
Enter array element : 5
Enter array element : 2
Enter array element : 6
Enter array element : 2
Enter array element : 7
OUTPUT
Yes , number exists in array
Frequency of 2 is : 4
Process returned 22 (0x16) execution time : 26.729 s
Press any key to continue.
*/
/*
Name : Shrish Kumar
Roll No. : 13
Section : F
Problem Statement
Write a program to calculate nCr for a number
*/#include<stdio.h>
int n,c;
int f;
int fact(int x)
{
f=1;
for(int i=1;i<=x;i++)
{
f=f*i;
}
return f;
}
void main()
{
printf("\t INPUT \n");
printf("Enter n :");
scanf("%d",&n);
printf("Enter r :");
scanf("%d",&c);
printf("\t OUTPUT \n");
double result = fact(n)/(fact(c)*fact(n-c));
printf("Result : %f",result);
}
/*
INPUT
Enter n :4
Enter r :3
OUTPUT
Result : 4.000000
Process returned 17 (0x11) execution time :
5.888 s
Press any key to continue.
*/
/*
Roll No. : 13
Section : F
Problem Statement
*/
#include <stdio.h>
int sum,n;
int sumo(int x)
sum = 0;
while(x!=0)
int l=x%10;
sum = sum+l;
x=x/10;
return sum;
void main()
scanf("%d",&n);
int a[n];
for(int i=0;i<n;i++)
scanf("%d",&a[i]);
for(int i=0;i<n;i++)
int y = sumo(a[i]);
printf("%d ",y);
}
/*
INPUT
Enter size of array :10
Enter array elements :19
Enter array elements :22
Enter array elements :32
Enter array elements :43
Enter array elements :554
Enter array elements :65
Enter array elements :728
Enter array elements :768
Enter array elements :62
Enter array elements :7
OUTPUT
10 4 5 7 14 11 17 21 8 7
Process returned 10 (0xA) execution time :
20.400 s
Press any key to continue.
*/
#include <stdio.h>
void main()
{
int n;
printf("\t INPUT \n");
printf("Enter number of rows or columns :");
scanf("%d",&n);
int a[n][n];
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
printf("Enter array element : ");
scanf("%d",&a[i][j]);
}
}
printf("\t OUTPUT \n");
for(int i=0;i<n;i++)
{
int k=n-i-1;
printf("%d ",a[i][k]);
}
}
/*
INPUT
Enter number of rows or columns :3
Enter array element : 2
Enter array element : 2
Enter array element : 4
Enter array element : 1
Enter array element : 2
Enter array element : 5
Enter array element : 3
Enter array element : 4
Enter array element : 6
OUTPUT
423
Process returned 3 (0x3) execution time : 15.120 s
Press any key to continue.
*/
/*
Roll No. : 13
Section : F
Problem Statement
*/
#include <stdio.h>
int n,sums;
int sum(int y)
if(y==1)
return 1;
else
return (pow(n,2)+sum(n--));
void main()
scanf("%d",&n);
int x = sum(n)-1;
printf("%d",x);
}
/*
INPUT
Enter number :4
OUTPUT
30
Process returned 2 (0x2) execution time :
0.905 s
Press any key to continue.
*/
/*
Roll No. : 13
Section : F
Problem Statement
*/
#include <stdio.h>
int main()
{ int m, n, p, q, c, d, k, sum = 0;
scanf("%d", &first[c][d]);
if (n != p)
else
scanf("%d", &second[c][d]);
printf("%d\t", multiply[c][d]);
printf("\n"); } } return 0; }
/*
INPUT
OUTPUT
19 22
43 50
*/