solve it with turbo c
Moderators:Labib, bristy1588
$S=1^k+(1^k+2^k)+(1^k+2^k+3^k)+.....(1^k+2^k+3^k+....+n^k)$
u have to take input $n\, and\, k$ from user and ur programme will give the result $S$
u have to take input $n\, and\, k$ from user and ur programme will give the result $S$
A man is not finished when he's defeated, he's finished when he quits.
Re: solve it with turbo c
আমি প্রোগ্রামিং পারি না তেমন তবে এইটাকে লিখা যায়, \
এখন এইটা করার জন্য তো কিছুই দরকার হওয়ার কথা না!
এখন এইটা করার জন্য তো কিছুই দরকার হওয়ার কথা না!
"Inspiration is needed in geometry, just as much as in poetry." -- Aleksandr Pushkin
Please install LaTeX fonts in your PC for better looking equations,
learn how to write equations, and don't forget to read Forum Guide and Rules.
Please install LaTeX fonts in your PC for better looking equations,
learn how to write equations, and don't forget to read Forum Guide and Rules.
Re: solve it with turbo c
hehe. U r not allowed to use theorem. Thats the problem we have to do it with for loop.
A man is not finished when he's defeated, he's finished when he quits.
Re: solve it with turbo c
আমি তো এইখানে কোন সূত্র ব্যবহার করি নাই।
কেন তুমি যদি লুপ দিয়ে ১ থেকে $n$ পর্যন্ত যোগফল নির্ণয় করতে পার এইটাতে সমস্যা কি?
$S=S+(n-i+1)\cdot i^k$ ব্যবহার কর তাহলেই তো হয়। অবশ্য সরাসরি exponent লিখা যায় না, সুতরাং একটা nested loop চালাইলেই তো হয়।
exponent এর ব্যাপারে আরো জানতে: http://www.dreamincode.net/forums/topic ... c-program/
কেন তুমি যদি লুপ দিয়ে ১ থেকে $n$ পর্যন্ত যোগফল নির্ণয় করতে পার এইটাতে সমস্যা কি?
$S=S+(n-i+1)\cdot i^k$ ব্যবহার কর তাহলেই তো হয়। অবশ্য সরাসরি exponent লিখা যায় না, সুতরাং একটা nested loop চালাইলেই তো হয়।
exponent এর ব্যাপারে আরো জানতে: http://www.dreamincode.net/forums/topic ... c-program/
"Inspiration is needed in geometry, just as much as in poetry." -- Aleksandr Pushkin
Please install LaTeX fonts in your PC for better looking equations,
learn how to write equations, and don't forget to read Forum Guide and Rules.
Please install LaTeX fonts in your PC for better looking equations,
learn how to write equations, and don't forget to read Forum Guide and Rules.
Re: solve it with turbo c
আসলে হাসিবের প্রশ্নটাইতো পরিষ্কার না।কোন থিওরেম ব্যবহার করা যাবে না মানেকি??প্রোগ্রামিং সমস্যায় সূত্র ব্যবহার না করা মানে তো অনেকটা কাগজে দাগ দেয়া ছাড়া রচনা লেখার মত।এরকম সমস্যায় তুমি এটা বলতে পার যে সমস্যাটা কত complexity তে সমাধান করতে হবে।complexity কি?? মনে কর একটা প্রোগ্রাম-
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
operation();
}
}
এই প্রোগ্রামে দেখ কতবার অপারেশন করে?? n*n বা n^2 বার।তার মানে এর complexity n^2 বা O(n^2).কম্পিউটার সাধারণত ১ সেকেন্ডে 10^7 টার মত অপারেশন করতে পারে।তো n এর মান যদি 10000 হয় তাহলে মনে কর এই সমস্যাটা ১ সেকেন্ডে হয়ত সমাধান হবেনা।
তো তুমি একটা সমস্যা দিলে এটা বলতে পার এটা কি complexity তে করতে হবে বা অন্যকিছু।কিন্তু এটা বলা তো অপরাধ যে কোন সূত্র ব্যবহার করা যাবেনা।
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
operation();
}
}
এই প্রোগ্রামে দেখ কতবার অপারেশন করে?? n*n বা n^2 বার।তার মানে এর complexity n^2 বা O(n^2).কম্পিউটার সাধারণত ১ সেকেন্ডে 10^7 টার মত অপারেশন করতে পারে।তো n এর মান যদি 10000 হয় তাহলে মনে কর এই সমস্যাটা ১ সেকেন্ডে হয়ত সমাধান হবেনা।
তো তুমি একটা সমস্যা দিলে এটা বলতে পার এটা কি complexity তে করতে হবে বা অন্যকিছু।কিন্তু এটা বলা তো অপরাধ যে কোন সূত্র ব্যবহার করা যাবেনা।
Re: solve it with turbo c
@Sakib vai:: oh, i am explain what i wanted to say.
Let, u r told to sum out the serius $1+2+3+....+n$ we can easily give an assignment
int s=(n(n+1))/2
but, i wanna do this with for loop like:
int s=0;
for(int i=1;i<=n;i++)
{
s=s+i;
}
i wanna do that one in this way. Please, write down the prgrm fully what u say. I am just new to turbo c
Let, u r told to sum out the serius $1+2+3+....+n$ we can easily give an assignment
int s=(n(n+1))/2
but, i wanna do this with for loop like:
int s=0;
for(int i=1;i<=n;i++)
{
s=s+i;
}
i wanna do that one in this way. Please, write down the prgrm fully what u say. I am just new to turbo c
A man is not finished when he's defeated, he's finished when he quits.
-
- Posts:135
- Joined:Thu Dec 09, 2010 12:10 pm
Re: solve it with turbo c
Moon wrote:...অবশ্য সরাসরি exponent লিখা যায় না, সুতরাং একটা nested loop চালাইলেই তো হয়।
exponent এর ব্যাপারে আরো জানতে: http://www.dreamincode.net/forums/topic ... c-program/
Code: Select all
#include<stdio.h>
#include<math.h>
int main()
{
int i, k, c;
scanf("%d %d", &i, &k);
c=pow(i, k);
printf("%d\n", c);
return 0;
}
Re: solve it with turbo c
HandaramTheGreat wrote:
Code: Select all
#include<stdio.h> #include<math.h> int main() { int i, k, c; scanf("%d %d", &i, &k); c=pow(i, k); printf("%d\n", c); return 0; }
is it my solution?
A man is not finished when he's defeated, he's finished when he quits.
Re: solve it with turbo c
HandaramTheGreat wrote:
Code: Select all
#include<stdio.h> #include<math.h> int main() { int i, k, c; scanf("%d %d", &i, &k); c=pow(i, k); printf("%d\n", c); return 0; }
is it my solution?
A man is not finished when he's defeated, he's finished when he quits.
Re: solve it with turbo c
Do you mean it should be exactly one loop? No nested loops? That can be a logical constraint.hasib.mo wrote: Let, u r told to sum out the serius $1+2+3+....+n$ we can easily give an assignment
int s=(n(n+1))/2
but, i wanna do this with for loop like:
int s=0;
for(int i=1;i<=n;i++)
{
s=s+i;
}
i wanna do that one in this way. Please, write down the prgrm fully what u say.
Being new in turbo C makes no sense. Are you new in C?hasib.mo wrote: I am just new to turbo c