k^2 + k = k^2 + k k^2 x k = k^3
#include<stdio.h> void main() { int a[3][3],b[3][3],c[3][3],i,j,k; clrscr(); printf("Enter elements of A:"); for(i=0;i<=2;i++) for(j=0;j<=2;j++) scanf("%d",&a[i][j]); printf("Enter elements of B:"); for(i=0;i<=2;i++) for(j=0;j<=2;j++) scanf("%d",&b[i][j]); printf("A:"); for(i=0;i<=2;i++) { for(j=0;j<=2;j++) printf("%d ",a[i][j]); printf(""); //To change line. } printf("B:"); for(i=0;i<=2;i++) { for(j=0;j<=2;j++) printf("%d ",b[i][j]); printf(""); } k=0; while(k<=2) { for(i=0;i<=2;i++) { int sum=0; for(j=0;j<=2;j++) sum=sum+a[i][j]*b[j][k]; c[i][k]=sum; } k++; } printf("Result: "); for(i=0;i<=2;i++) { for(j=0;j<=2;j++) printf("%d ",c[i][j]); printf(""); } getch(); }
Print "Type the upper limit (n) ?" Input n K = -1 WHILE K < = n K = K + 2 Sum = Sum + K WEND Print "The sum of all odd numbers up to "; n; "is "; Sum
i d k
The sum of any two sides of a triangle is greater than the third side. So, 3+4>k, that is k<7 Also, 3+k>4 so that k>1 So 1 < k < 7
#include <stdio.h> #include <conio.h> void main() { int d[3][3] = { 1, 2, 6, 3, 8, 5, 5, 6, 7 }; int k = 0, j = 0; int sum1 = 0, sum2 = 0; for (j = 0; j < 3; j++) { for (k = 0; k < 3; k++) printf(" %3d", d[j][k]); printf("\n"); } for (j = 0; j < 3; j++) { sum1 = sum1 + d[j][j]; } k = 3 - 1; for (j = 0; j < 3; j++) { if (k >= 0) { sum2 = sum2 + d[j][k]; k--; } } printf("Sum of First diagonal= %d\n", sum1); printf("Sum of Second diagonal= %d", sum2); getch();
17
6 divided by the sum of 4 times x and 5 times k is equal to 6 times the reciprocal of (4x + 5k).
#include<stdio.h> int main() { int count,i,j,k,n,*a,sum=0; printf("Enter the value of 'n':"); scanf("%d",&n); a=malloc(n*sizeof(int)); for(i=1;i<=n;i++) { count=0; j=1; while(j<=i) { if(i%j==0 && i!=2) count++; j++; } if(count==2 count==1) { for(k=0;k<=n;k++) a[k]=i; } } for(k=0;k<=n;k=k+1) printf("%d\t",a[k]); for(k=0;k<=n;k=k+2) sum+=a[k] * a[k]; printf("The sum of squares of alternative prime numbers is=%d",sum); getchar(); return 0; }
#includeint main(){int count,i,j,k,n,*a,sum=0;printf("Enter the value of 'n':");scanf("%d",&n);a=malloc(n*sizeof(int));for(i=1;i
for (n=1; n<1000; ++n) { for (sum=0, k=1; k<=n/2; ++k) if (n%k==0) sum += k; if (sum==n) printf ("%d\n", n); }
k^2 + k = k^2 + k k^2 x k = k^3
#include<stdio.h> void main() { int a[3][3],b[3][3],c[3][3],i,j,k; clrscr(); printf("Enter elements of A:"); for(i=0;i<=2;i++) for(j=0;j<=2;j++) scanf("%d",&a[i][j]); printf("Enter elements of B:"); for(i=0;i<=2;i++) for(j=0;j<=2;j++) scanf("%d",&b[i][j]); printf("A:"); for(i=0;i<=2;i++) { for(j=0;j<=2;j++) printf("%d ",a[i][j]); printf(""); //To change line. } printf("B:"); for(i=0;i<=2;i++) { for(j=0;j<=2;j++) printf("%d ",b[i][j]); printf(""); } k=0; while(k<=2) { for(i=0;i<=2;i++) { int sum=0; for(j=0;j<=2;j++) sum=sum+a[i][j]*b[j][k]; c[i][k]=sum; } k++; } printf("Result: "); for(i=0;i<=2;i++) { for(j=0;j<=2;j++) printf("%d ",c[i][j]); printf(""); } getch(); }
//by rsravan12 #include<stdio.h> #include<conio.h> void main() { long int num,sum,k,temp ; clrscr(); printf("\nenter num= "); scanf("%d",&num); sum=0;num=temp; while(temp>0) { temp=temp%10; sum=sum+k*k*k; temp=temp/10; } if(num==sum) { printf("\n%d is armstrong",num); } else { printf("\n%d is not a armstrong",num); } getch(); } //hyderabad
I d f k :3
Print "Type the upper limit (n) ?" Input n K = -1 WHILE K < = n K = K + 2 Sum = Sum + K WEND Print "The sum of all odd numbers up to "; n; "is "; Sum
The simplest rule that will generate the 4 terms, and the nth term isUn = 2n2 + n + 3Then Sn = Sum for k = 1 to n of (2k2 + k + 3)= 2*sum(k2) + sum(k) + sum(3)= 2*n*(n+1)*(2n+1)/6 + n*(n+1)/2 + 3*n= (2n3 + 3n2 + n)/3 + (n2 + n)/2 + 3n= (4n3 + 9n2 + 23n)/6The simplest rule that will generate the 4 terms, and the nth term isUn = 2n2 + n + 3Then Sn = Sum for k = 1 to n of (2k2 + k + 3)= 2*sum(k2) + sum(k) + sum(3)= 2*n*(n+1)*(2n+1)/6 + n*(n+1)/2 + 3*n= (2n3 + 3n2 + n)/3 + (n2 + n)/2 + 3n= (4n3 + 9n2 + 23n)/6The simplest rule that will generate the 4 terms, and the nth term isUn = 2n2 + n + 3Then Sn = Sum for k = 1 to n of (2k2 + k + 3)= 2*sum(k2) + sum(k) + sum(3)= 2*n*(n+1)*(2n+1)/6 + n*(n+1)/2 + 3*n= (2n3 + 3n2 + n)/3 + (n2 + n)/2 + 3n= (4n3 + 9n2 + 23n)/6The simplest rule that will generate the 4 terms, and the nth term isUn = 2n2 + n + 3Then Sn = Sum for k = 1 to n of (2k2 + k + 3)= 2*sum(k2) + sum(k) + sum(3)= 2*n*(n+1)*(2n+1)/6 + n*(n+1)/2 + 3*n= (2n3 + 3n2 + n)/3 + (n2 + n)/2 + 3n= (4n3 + 9n2 + 23n)/6