Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem with the complexity of the program 2011
#1
Code:
#include <iostream.h> int ver(int a){ while(a%2==0) a=a/2; while(a%3==0) a=a/3; while(a%5==0) a=a/5 if(a==1) return 1; else return 0;} void main(){ int n,i; i=1; cin>>n; cout<<endl; while(n!=0){ if(ver(i)==1){ cout<<i<<" "; n--;} i++;}}

0300-9520262
Get solution in 24 hour
|cpmputer & internetConfusedmileys81:[SIZE="4"][SIZE="3"]....[/SIZE][/SIZE]
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  c++ program on unix varup 0 7,585 10-10-2012, 06:16 PM
Last Post: varup
  i take input from getchar(); function in program in C++ 2012 Vuhelper 0 2,998 05-31-2012, 01:40 AM
Last Post: Vuhelper
  program Output in C++ 2012 Vuhelper 0 2,961 01-06-2012, 12:28 AM
Last Post: Vuhelper
  For running C++ program from command prompt “gcc” and “g++” compilers are used. Vuhelper 0 6,391 01-04-2012, 10:41 PM
Last Post: Vuhelper
  array project code c++ 2011 Vuhelper 0 1,276 12-10-2011, 06:32 PM
Last Post: Vuhelper
  factorial in C++ code 2011 Vuhelper 0 949 12-10-2011, 06:31 PM
Last Post: Vuhelper
  stack during function call in C++ 2011 Vuhelper 0 2,027 11-05-2011, 05:05 PM
Last Post: Vuhelper
  Function (Retrun push)for what purpose use in the program. ? Vuhelper 0 1,861 11-05-2011, 05:03 PM
Last Post: Vuhelper
  What is the Thing Queue? in c++ 2011 Vuhelper 0 1,785 11-05-2011, 05:02 PM
Last Post: Vuhelper
  ASCII to char conversion code in C++ 2011 Vuhelper 0 1,723 11-05-2011, 05:01 PM
Last Post: Vuhelper

Forum Jump:


Users browsing this thread: 1 Guest(s)