S

@soupra

prime number or no

C
2 years ago
#include <stdio.h> int main() { int a; int flag=0; printf("enter the number: \n"); scanf("%d",&a); for(int i=2;i<=a/2;i++) {

right angle triangle

C
2 years ago
#include <stdio.h> int main() { int a; printf("enter the number of rows: \n"); scanf("%d",&a); for(int i=1;i<=a;i++) { for(int j=1;j<=i;j++)

q3

Python
2 years ago
L=int(input('enter the length of the rectangle:')) print(' ') B=int(input('enter the breadth of the rectangle:')) print(' ') P=2*(L+B) print('the perimeter of the rectangle is: ') print(P)

q2

Python
2 years ago
a=int(input('purchase amount=')) print(' ') b=int(input('amount costed for repairs=')) print(' ') c=int(input('sold amount')) print(' ') d=(c-(a+b))/100 print('profit %:') print(' ') print(d)

q1

Python
2 years ago
p=int(input('amount taken=')) print(' ') r=int(input('time(in years)=')) print(' ') t=int(input('interest rate=')) print(' ') z=(p*r*t)/100 print('the simple interest is:') print(' ') print(z)

matrix multiplication

C
2 years ago
#include <stdio.h> int main() { int matrix1[3][3]={{2,3,5},{1,4,5},{2,5,6}}; int matrix2[3][3]={{5,6,7},{6,8,9},{4,8,9}}; int matrix3[3][3]; printf("the first matrix is:\n"); for(int i=0;i<3;i++) { for(int j=0;j<3;j++)

fact

C
2 years ago
#include <stdio.h> int fact(int m) { if(m<=1) { return 1; } else { return m*fact(m-1);

fibs

C
2 years ago
#include <stdio.h> int fibs(int k) { if(k<=1) { return k; } else { return fibs(k-1)+fibs(k-2);

sum of all elements in array

C
2 years ago
#include <stdio.h> #include <string.h> int sum(int *arr,int size) { int sum=0; int *ptr=arr; for(int i=0;i<size;i++) { sum+=*ptr; ptr++;

square of a number using pointers

C
2 years ago
#include <stdio.h> void square(int *num) { *num=(*num)*(*num); } int main() { int number; printf("enter the number to be squared:\n"); scanf("%d",&number);

number of vowels

C
2 years ago
#include <stdio.h> #include <string.h> int main() { char string[100]; printf("enter the string:\n"); fgets(string,100,stdin); int n=strlen(string); int vowelcount=0,consocount=0; for(int i=0;i<n;i++)

total number of words

C
2 years ago
#include <stdio.h> #include <string.h> int main() { char s[100]; printf("enter the string:\n"); fgets(s,100,stdin); int totalwords=1; for(int i=0;s[i]!='\0';i++) {

Factorial using recursion in c

C
2 years ago
#include<stdio.h> int multiplynumbers(int n); int main() { int n; printf("Enter a value : \n"); scanf("%d",&n); printf("The factorial of %d = %d",n,multiplynumbers(n)); } int multiplynumbers(int n)

input string and print it

C
2 years ago
#include <stdio.h> int main() { char inputstring[100]; printf("enter the input string:\n"); fgets(inputstring,100,stdin); printf("the entered string is %s\n",inputstring); return 0; }

roots of quadratic equation

C
2 years ago
#include <stdio.h> #include <math.h> int main () { int a,b,c,D; float root1,root2; printf("the coefficients (a,b,c)\n"); scanf("%d",&a); scanf("%d",&b); scanf("%d",&c);

area of circle

C
2 years ago
#include <stdio.h> #include <math.h> int main() { float r,area,PI; PI=3.14; scanf("%f",&r); if(r>0) { area=r*r*PI;

hcf of two numbers

C
2 years ago
#include <stdio.h> int main() { int a,b,c,d,e; scanf("%d",&a); printf("the value of a is %d",a); scanf("%d",&b); printf("the values of b is %d",b); c=a%b; d=b%c;

print numbers from 1 to 10

C
2 years ago
#include <stdio.h> int main() { int i; scanf("%d",&i); for(i=1;i<11;i++) { printf("%d",i); }

4

C
2 years ago
#include <stdio.h> int main() { int a; scanf("%d",&a); switch(a) { case 1: printf("jan"); break;

3

C
2 years ago
#include <stdio.h> int main() { int a; scanf("%d",&a); switch(a) { case 18: printf("you are not eligible for voting"); break;