Categories

## (C Language) prime factorization. How to make output 2 2 2 3 7 7 become 2^3 * 3^1 * 7^2?

#include <stdio.h> int main() { int n,i; scanf("%d",&n); for(i=2;i>=n/2;i++) { while(n%i==0) { printf("%d ",i); n=n/i; } } return 0; } (C Language) prime factorization. How to make output 2 2 2 3 7 7 become 2^3 * 3^1 * 7^2 ?

Categories

## How I solve this simple problem with CodeBlock?

I’m a beginner and have 3 file to sum recursive an array. array.h int sum(int n, int a[]); void create_array(int n, int a[]); array.c #include<stdio.h> #include<stdlib.h> #include “array.h” void create_array(int n, int a[]){ int i; for( i=0;i<n;i++){ printf(“Inserire il %d elemento dell’array\n”,i); scanf(“%d”,&a[i]); } return; } int sum(int n, int a[]){ if(n>0){ return a[n-1]+sum(n-1,a); } […]

Categories

## Why can’t i get this simple C program to work?

I am making a simple console program that is supposed to enable the user to enter an array and the program is supposed to display the arithmetic average of all the numbers, but no matter what i try i just cant get this to work. Can anyone here point out why this isn’t working. Thank […]

Categories

## Why my area problem is giving wrong answer?

I am learning c. So, I was practicing in a online judge. I have got a logic behind the problem and submitted ans got wrong answer. What is the problem? Problem: Area 100 Points · Limits 1s, 512 MB In this problem, you will be given a square which has a length of n. Co-ordinates […]

Categories

## Need help scanning a char* into a function with struct

I’m just starting to learn C in one of my college courses. We have gone over similar topics but not quite like what my professor is asking. I’m not great at all with pointers or structs so this assignment is getting frustrating, but I’m getting only one error in my last scanf saying “expected type […]